
In this article we would extend your skills which you have set from our last article. If you have skipped our last article I recommended you to complete that first.
System administrator commands in linux
Login from normal user

Create two file and write some text in them.
$cat > one This is first file $cat > second This is second file
Now we will combine these two files in a single file. In standard linux its call redirection of output.
$cat one second > new
$cat new
This is first file This is second files

Then what exactly this command did? As you know cat command is used to display the content of file so it will first display the content of first file and then it will display the content of second file. But as you put a > sign at the end of command so despite of showing this output on screen command will redirect these contents to a file.
$[command] ; [command] ; [command] ;[command]……..
To execute multiple commands from single line use a ; between them form example
$cat new ; mkdir xyz ; mkdir rat ; ls This is first file This is second files new xyz rat

this command will first execute the first command which is cat new so it will display the matter of new file, further is mkdir xyz so it will create a xyz directory , further is mkdir rat so will create a rat directory and in the end we use ls command so it will list the contain of current directory.
To create multiple sub directory from a single command use –p switch with mkdir command for example
$mkdir –p a/b/c/d/f/g/h/i/j
In this example we created 9 subdirectories form a single mkdir command. Now verify it by listing.
$ls new xyz rat a
now change the directory to verify the depth of directories.
$cd a/b/c/d/f/g/h/i/j $pwd /home/vinita/a/b/c/d/f/g/h/i/j
Come back to home directory. Simple cd command without passing any argument will do this.
$cd

Give all files name one by one with a single space between them and in the end give the destination directory name for example
$mv new first second xyz

This command will move three files new, one, second to the xyz directory.
$cd xyz
$ls New one second
$cd ..
tar command is used to take the back up with –cvf switches and the same tar command is used to restore the matter with –xvf switches. For example
$tar –cvf backup.tar xyz
$ls
$rm –rf xyz

In linux you cannot restore the data once deleted unless you have backup. Now restore these files and directory.
$tar –xvf backup.tar
$ls $cd xyz
$ls new first second
$cd ..
Create a large file and check how much disk space is consumed by this file
$man ls > manoj $du –h manoj 12k manoj
File manoj is using 12k space on hard disk. For exam prospective you should familiar with two compress utilities.
$bzip2 [file name] {command syntax}
$bzip2 manoj
$ls
$du -h manoj.bz2
4k manoj.bz2 
To decompress file
$bzip2 –d manoj.bz2
$ls manoj
as you can show file has been decompressed. Now use other utility to compress the file.
$gzip manoj
$ls manoj.gz
$du –h manoj.gz 4k manoj.gz
$gzip –d manoj.gz
$ls manoj

Search more about
Search in Google for
