Tuesday, November 27, 2012

Fourteenth session of Some of basic UNIX commands that are useful very frequently


In todays session, we will discuss about some more useful commands which are used frequently in UNIX/LINUX based Operating Systems.

df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

As described in previous post, you can get the value of environment variable POSIXLY_CORRECT by echo command.

df filename.jpg

As depicted, above command will shows disk space available on the file system containing 'filename.jpg'. Below is output:

sanny@sanny-Inspiron-3420:~/Desktop$ df filename.jpg
Filesystem    1K-blocks       Used     Available   Use%   Mounted on
/dev/sda6    171485500     3372236  159402232         3%        /


There are some common features available which are used for I/O Redirection.

'<' Input Redirection. This allows one to take input from file rather than standard input (stdin) taken from console.

Ex: tr a x < filename

'>' Output Redirection. This allows one to take output to file rather than standard output (stdout) printed to console.

Ex: ls -a > filename

'|' Pipe This allows one to take one command's output to another commands input.

Ex: ls -a | more

When you are free, dont hesitate to try these and post your feedback. Will discuss about some more useful commands in next posts.