General Command-line Tips

From wiki
Jump to: navigation, search

Introduction

Tips for using the command line

.bashrc

This is a hidden (starts with a dot) file in your home directory which is used for holding various customisations in the shape of aliases and functions that minimise typing and make things faster.

For example, to obtain a long listing of all files in a directory from oldest to newest, the command is

ls -altr

But you can include a line in your .bashrc like so

alias ltr='ls -altr'

which mean s

If you already have a t is also

if [ -f /etc/bashrc ]; then
   . /etc/bashrc
fi

if [ -f /usr/local/Modules/3.2.10/init/.bashrc ]; then
   . /usr/local/Modules/3.2.10/init/.bashrc
fi

Special Characters in Linux

Let's consider the copyright character. YOu need to hold down Ctrl+ Shift and type UA9. U00A9 will also work, but it's longer of course: ©.


GNU Parallel

To check the md5sums of a number of files according to a md5sum, one mat use this:

cat <file_with_md5sums> |parallel --pipe -N1 md5sum -c

(it would be nice to know the number of parallel processes this would generate)