General Command-line Tips

From wiki
Revision as of 11:19, 7 December 2016 by Rf (talk | contribs)
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

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)