Have you ever done something like this?
$ grep somestring file1 > /tmp/a
$ grep somestring file2 > /tmp/b
$ diff /tmp/a /tmp/b
That works, but instead you can write:
diff <(grep somestring file1) <(grep somestring file2)
Tips:
-d
is the destination printer and it supports autocomplete with _-n
is the number of commands-o
means the options. For all options available try lpoptions -l
An example of command:
$ lp -d HP_Deskjet -n 50 -o OutputMode=FastDraft Documents/sablon_congres.pdf
e.g to change the name of a file from old.name to old.name_backup:
$ mv old.name{,_backup}
$ yes | rm -r ~/some/dir
$ printenv | less
You could evaluate the exit status:
some_command
if [ $? -neq 0 ]; then
echo "FAIL"
fi
Or, the most simple way
if some_command; then
echo "OK"
else
echo "FAIL"
fi
With suffix aliases, you can launch files with a specific extension (or suffix) in your favorite tool.
To register a suffix alias, we use the alias -s extension=name-of-the-tool
pattern.
alias -s pdf=zathura
alias -s {ape,avi,flv,m4a,mkv,mov,mp3,mp4,mpeg,mpg,ogg,ogm,wav,webm}=mpv
alias -s {jpg,jpeg,png}=feh
alias -s git='git clone'
A global alias is aggressive. Once registered, it replaces all occurrences of the alias name with the specified command. The definition follows the pattern
alias -g NF='./*(oc[1])'
This points to the newest file/dir in my current dir, and it is very easy for me to untar a downloaded
file and then cd into it without caring about the name of the file/dir.
tar xf NF; cd NF
source
source
Install SSHFS.
sshfs name@server:/path/to/folder /path/to/mount/point
When using reverse-i-search you have to type some part of the command that you want to retrieve. It’s possible to label your commands and access them easily by pressing ^R and typing the label (should be short and descriptive).
$ some_very_long_and_complex_command # label
source
lsof -P -i -n
source
$ some_command | convert label:@- some_name.png
source
$ mkdir -p first/second/third
source