Sometimes I like to create a backup file when I'm about to edit the original, like say httpd.conf or similar and the path could be rather lengthy, so something like this saves you some typing:
Code:
# ls /etc/httpd/conf.d/httpd.conf
httpd.conf
# cp /etc/httpd/conf.d/httpd.conf{,.bak}
# ls /etc/httpd/conf.d/httpd.conf*
httpd.conf httpd.conf.bak
You could pretty much do the same thing to compare the files later with diff by doing:
Code:
# diff /etc/httpd/conf.d/httpd.conf{.bak,}
Another thing I like or find handy is something like this to take the previous listings after a command to run against another command:
Code:
# touch file1 file2 file3
# ls !*
ls file1 file2 file3
file1 file2 file3
Also something else I don't see used as often is this and comes in handy to switch back to a directory with little typing:
Code:
# cd /home/trickykid
# pushd .
/home/trickykid /home/trickykid
# cd /var/lib/mysql
# popd
/home/trickykid
# pwd
/home/trickykid