This evening i will be showing a group of students some of my favorite command-line tricks. Does anyone have any favorites that you think need to be in a "greatest hits"?
#shell #unix #linux #commandLine
@markgalassi So many to choose from, but one of my most commonly-used ones is:
cd -
(go back to the directory you were in previously). I never had the foresight to use a tool like pushd/popd.
@kyle Interesting: I am an avid pushd/popd user, so I never used "cd -", but I will mention it for the non-pushd/popd people.
@markgalassi remember that not everything about the command line is the shell, some is readline (unless zsh?). But, betting you'll cover bash, i'd suggest
(a) tab completion (b) ^R history search, (c) apropos
@http http, thanks! I am an avid user of tab completion and even more of ^R (which I use nonstop - maybe because I'm a 40 year emacs user).
Vis-a-vis apropos, I am not so convinced: I just tried `apropos pdf annotation` hoping it would hone in on xournalpp, but instead of gave 83 matches with various pdf manipulators. "apropos C compiler" is also quite useless: it gives gcc, as well as 11720 other matches. Maybe I need to understand "apropos" better.
@markgalassi
alias rt='/bin/ls -lrt'
so that rt lists the most recently touched file last.
Or this:
ff ()
{
find . -iname "*$1*"
}
so you can call
ff blarg
to find any file in the current and subdirectories having blarg in its name, ignoring case. Extending the function to not search the current but a given directory with the current as default left as an exercise:-)
@HaraldKi I have (and use all the time) the same aliases but with different names :-)
I use "lst" for the reverse chrono listing, and I pipe it to head -13
And my "find/print" alias I call "fil" (find with the -ls option) or "fip" (find with the -print option, better for pipes).
But I had not put in the "ignore case" which I like a lot and I will now change to doing that - thanks!
@markgalassi alt-. or esc-. to pull up the last argument of the previous command.
@vagrantc
interesting: i use a csh- vestigial !$
but I'll try those