--Create new tar
#tar -cvf tar_file_name.tar dirname/
--Extract from tar
#tar -xvf tar_file.tar
--view tar file
#tar -tvf tar_file_name.tar
--Search for given string
#grep -i "hostname" file_name
--Search for a given string in all files recursively
#grep -r "hostname" *
--Find file
#find -iname "filename"
--Execute commands on files found by the find command
#find -iname "filename" -exec rm -rf {} \; --It will find the file and delete it.
--Find empty files in home directory
#find ~ -empty
--Convert DOS file to Unix file format
#sed 's/.$//' filename
--Print file content in reverse order
#sed -n '1!G;h;$p' filename
--Add line number for all non-empty-lines in a file
#sed '/./=' filename | sed 'N; s/\n/ /'
--Remove duplicate lines using awk
#awk '!($0 in array) { array[$0]; print }' filename
--Print all lines from /etc/passwd that has the same uid and gid
#awk -F ':' '$3==$4' passwd.txt
--Print only specific field from a file.
#awk '{print $2,$5;}' filename
--Sort a file in ascending order
#sort filename
--Sort a file in descending order
#sort -r filename
--Sort passwd file by 3rd field.
#sort -t: -k 3n /etc/passwd | more
--To view oracle related environment variables.
$export |grep ORACLE
--Visual Classification of Files With Special Characters Using ls -F
#ls -F
--To create a *.gz compressed file:
#gzip filename
--To uncompress a *.gz file:
#gzip -d filename.gz
--Display compression ratio of the compressed file using gzip -l
#gzip -l *.gz
--To create a *.bz2 compressed file:
#bzip2 filename
--To uncompress a *.bz2 file:
#bzip2 -d filename.bz2
--To extract a *.zip compressed file:
#unzip filename.zip
--View the contents of *.zip file without unzipping it:
#unzip -l filename.zip
---Shutdown the system and turn the power off immediately.
#shutdown -h now
---Shutdown the system after 10 minutes.
#shutdown -h +10
---Reboot the system using shutdown command.
#shutdown -r now
---Force the filesystem check during reboot.
#shutdown -Fr now
---Give full access to user and group (i.e read, write and execute ) on a specific file.
#chmod ug+rwx filename
---Revoke all access for the group (i.e read, write and execute ) on a specific file.
#chmod g-rwx filename
--Syncronize hardware clock after changing the system time
#hwclock –systohc
#tar -cvf tar_file_name.tar dirname/
--Extract from tar
#tar -xvf tar_file.tar
--view tar file
#tar -tvf tar_file_name.tar
--Search for given string
#grep -i "hostname" file_name
--Search for a given string in all files recursively
#grep -r "hostname" *
--Find file
#find -iname "filename"
--Execute commands on files found by the find command
#find -iname "filename" -exec rm -rf {} \; --It will find the file and delete it.
--Find empty files in home directory
#find ~ -empty
--Convert DOS file to Unix file format
#sed 's/.$//' filename
--Print file content in reverse order
#sed -n '1!G;h;$p' filename
--Add line number for all non-empty-lines in a file
#sed '/./=' filename | sed 'N; s/\n/ /'
--Remove duplicate lines using awk
#awk '!($0 in array) { array[$0]; print }' filename
--Print all lines from /etc/passwd that has the same uid and gid
#awk -F ':' '$3==$4' passwd.txt
--Print only specific field from a file.
#awk '{print $2,$5;}' filename
--Sort a file in ascending order
#sort filename
--Sort a file in descending order
#sort -r filename
--Sort passwd file by 3rd field.
#sort -t: -k 3n /etc/passwd | more
--To view oracle related environment variables.
$export |grep ORACLE
--Visual Classification of Files With Special Characters Using ls -F
#ls -F
--To create a *.gz compressed file:
#gzip filename
--To uncompress a *.gz file:
#gzip -d filename.gz
--Display compression ratio of the compressed file using gzip -l
#gzip -l *.gz
--To create a *.bz2 compressed file:
#bzip2 filename
--To uncompress a *.bz2 file:
#bzip2 -d filename.bz2
--To extract a *.zip compressed file:
#unzip filename.zip
--View the contents of *.zip file without unzipping it:
#unzip -l filename.zip
---Shutdown the system and turn the power off immediately.
#shutdown -h now
---Shutdown the system after 10 minutes.
#shutdown -h +10
---Reboot the system using shutdown command.
#shutdown -r now
---Force the filesystem check during reboot.
#shutdown -Fr now
---Give full access to user and group (i.e read, write and execute ) on a specific file.
#chmod ug+rwx filename
---Revoke all access for the group (i.e read, write and execute ) on a specific file.
#chmod g-rwx filename
--Syncronize hardware clock after changing the system time
#hwclock –systohc
No comments:
Post a Comment