Re:Ask HN: Best things in your bash_profile/aliases?
by Grimm665 on Monday January 14, 2019 @09:38AM
(#18903234)
My favorite new one that I have been using a lot:
It queries the cht.sh cheatsheet of various Unix commands. 'cheat tar' prints:
You do have to be online, but there are ways of downloading the directory of cheat sheets to use offline as well.
[ Parent
| on HN ]
Re:Ask HN: Best things in your bash_profile/aliases?
by joshstrange on Monday January 14, 2019 @02:36PM
(#18905723)
This is awesome, I ALWAYS have to google for how to untar an archive (I don't do it often enough to commit to memory) thank you!
Re:Ask HN: Best things in your bash_profile/aliases?
by aug-riedinger on Thursday January 24, 2019 @05:37AM
(#18987485)
I have:
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
instead
Re:Ask HN: Best things in your bash_profile/aliases?
by borplk on Tuesday January 15, 2019 @04:06AM
(#18909789)
tar czvf
"create ze vucking file"
tar xzvf
"extract ze vucking files"
Re:Ask HN: Best things in your bash_profile/aliases?
by stevekemp on Tuesday January 15, 2019 @02:35PM
(#18914160)
I have an alias "x" setup to run:
atool --extract $*
That will unpack "anything", into a sub-directory if necessary. Something I use more than any other alias.
Re:Ask HN: Best things in your bash_profile/aliases?
by zzo38computer on Monday January 14, 2019 @02:53PM
(#18905884)
There are man pages though, but still I suppose that might be useful to you.
Anyways, the only options for tar that I commonly use are "c", "x", and "t"; I will use other programs for decompression, and for extracting into a directory, will use cd.
Re:Ask HN: Best things in your bash_profile/aliases?
by acqq on Monday January 14, 2019 @03:15PM
(#18906062)
If the man pages had useful examples the “cheat sheets” would not be needed. So “duh use man pages” is a wrong and annoying answer in this context.
Re:Ask HN: Best things in your bash_profile/aliases?
by zzo38computer on Monday January 14, 2019 @07:03PM
(#18907784)
Yes, I suppose you are right, the man pages do not have sufficient examples. So, it is good that they add more there. (The man page still explains what all of the options are; now we have this "cheat sheets" with the examples, too.)
Re:Ask HN: Best things in your bash_profile/aliases?
by valtism on Monday January 14, 2019 @04:57PM
(#18906915)
There is a similar cli tool called tldr[1]. It's very useful and simple to invoke.
Re:Ask HN: Best things in your bash_profile/aliases?
by LinuxBender on Tuesday January 15, 2019 @12:23PM
(#18912865)
Nice. You might consider adding a check for the existence of a local cache file. If it doesn't exist, then try online. i.e.
if [ ! -s "${cache_dir}"/"$1" ] ; then ...
Re:Ask HN: Best things in your bash_profile/aliases?
by mpkc on Tuesday January 15, 2019 @07:31AM
(#18910689)
Thank you. It is so convenient to write some functions is .bash_profile. So powerful new skill.
Re:Ask HN: Best things in your bash_profile/aliases?
by yesenadam on Monday January 14, 2019 @04:07PM
(#18906483)
Cool, but on my Mac it makes flashing text..arggh.
Re:Ask HN: Best things in your bash_profile/aliases?
by icco on Monday January 14, 2019 @09:43PM
(#18908488)
Add -s to curl, should fix it.
Re:Ask HN: Best things in your bash_profile/aliases?
by yesenadam on Monday January 14, 2019 @10:04PM
(#18908557)
s for silent? I mean, all the text on the page is flashing on and off in sync..the whole page goes black. Its the first ESC code in the downloaded text, I guess..haven't quite figured out how to block that yet. If I then do an 'ls' (100s of files in that dir) it stops flashing, but when I scroll up, the first ls-ed files stay flashing..