How to redirect the matter of files in a new file
Create two file and write some text in them.$cat > oneThis is first file
$cat > secondThis 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 ; lsThis is first fileThis is second filesnew 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.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
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
$tar –xvf backup.tar
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 manoj12k 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.bz24k manoj.bz2
$gzip manoj
$ls
manoj.gz
$du –h manoj.gz
4k manoj.gz
$gzip –d manoj.gz
$ls
manoj







0 comments:
Post a Comment