juil 5 2009

Précis de commandes utiles

Here’s a list of very useful Linux shell commands. If you have some, feel free to share them in the comments, I’ll add ‘em to the list…

By the way, a quick poll, what’s your favorite shell? For me it’s — obviously — zsh!

script <filename>                              Saves everything output in the console in the
                                               file, until EOT (^D).
cd -                                           Go to prevous directory (not the parent one
                                               like cd ..).
C-l                                            The same as `clear`: cleans the console.
tac                                            The same as `cat` but in reverse order (from the
                                               last line of the file).
mkdir -p path/to/{dir1,dir2,.../{dir1,Dir2}}   Creates the whole tree.
dialog                                         Creates a GUI like environment. See man page.
nc -l -p PORT                                  Listens to the PORT, and outputs everything sent
                                               to it to stdout.
nc HOST PORT                                   Send the stdin to the HOST:PORT.
^err^new                                       Replaces 'err' by 'new' in the previous entry
pgrep <processname>                            PID of the processus named processname.
C-r + start typing                             Search the history.
watch -d <command>                             Executes command every 2sec (can be changed with
                                               --interval=secs) and show the differences in the output.
reset                                          Cleans the term, when binary output messed the
                                               thing up.
lsof                                           List open files.