RHEL Linux basic commands cat bzip gzip pwd cd mkdir
In our last assignment you perform some basic task related to system administration from normal user. In this assignment we will extend this further. To complete this assignment login form our normal user Vinita.
How to redirect the matter of files in a new file
Create two file and write some text in them.$cat > one This is first file $cat > second This is second fileNow 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
How to execute multiple commands in a single row
$[command] ; [command] ; [command] ;[command]……..To execute multiple commands from single row use a ; between them form example
$cat new ; mkdir xyz ; mkdir rat ; ls This is first file This is second files new xyz rat

How to create multiple sub directory form single command
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/jIn this example we created 9 subdirectories form a single mkdir command. Now verify it by listing.
$ls new xyz rat anow 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/jCome back to home directory. Simple cd command without passing any argument will do this.
$cd
How to move multiple file in directory with a single commands?
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
$cd xyz $ls New one second $cd ..
how to take back-up and restore files and directories.
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

$tar –xvf backup.tar $ls $cd xyz $ls new first second $cd ..
How to compress files to save disk space?
Create a large file and check how much disk space is consumed by this file$man ls > manoj $du –h manoj 12k manojFile 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
$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
No comments:
Post a Comment