Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Share your command line features and tricks for Unix/Linux. Try to keep it shell/distro agnostic if possible. Interested in seeing aliases, one-liners, keyboard shortcuts, small shell scripts, etc.

share
comments disabled on deleted / locked posts

locked by Michael Mrozek Nov 6 '11 at 0:41

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

63 Answers

My favs are below. I use most of them regularly

df -k (check filesystems) kill or kill -9 (kill a process) set -o vi (set your command line to vi) topas (performance tool) mount/unmount

oh yeah and how could I forget the > (to redirect output to a file) ls > /tmp/tmp.txt

Many more but some off the top of me head.

share
add comment

I often notice, just after starting a 15-minute-command, that I would have wanted to add some other stuff to the command line using && . Instead of interrupting the already-running job, I tend to use at to queue the second one, giving myself a longer time I don't need to watch the terminal.

Generally, at queues jobs for execution at a given time:

$ at 14:30
> myscript
> anotherscript
> <CTRL-D>

Entries to the queue can be viewed with atq and removed with atrm.

Another addition to the bash prompt customization tips: I like to invert the prompt, as this gives good visual cues where command output begins and ends in long terminal listings. This works well for both bright and dark backgrounds.

export PS1="\[\e[7m\][\u@\h \w]\[\e[0m\]$ "
share
add comment
find path expr -exec ls -ld {} \;

Nice easy way to see ownership, permissions, sizes (if files), and other characteristics of whatever your 'find' expression returns.

share
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.