Hello Friends, This is Gaurav Gupta from Gurgaon, India. By profession I am an UNIX Systems Administrator and have proven career track on UNIX Systems Administration. This blog is written from both my research and my experience. The methods I describe herein are those that I have used and that have worked for me. It is highly recommended that you do further research on this subject. If you choose to use this document as a guide, you do so at your own risk.
Tuesday, May 17, 2011
Unix basic troubleshooting command
Troubleshooting
------------------------
Files System
How to find a name in a file/directory:
# find . –type f –exec grep –ls {} \;
Check Files Sizes
Search for the 5 largest directories (MB) on a Unix System:
Command: # du –sk *
sort –nr
head
Find the largest files on a Unix System:
Command: # du –k
sort –nr
Check the size of a directory on a Unix System:
Command: # du –sk .
Core Files
Command: File
Description: Shows which process is responsible for the core dump.
Compare file1 and file2 and put result in file3
Command: sdiff –l
Compress big files to readable format (octal dump)
Command: od –ad –t cd1
How to remove ^M out of a file
# dos2unix
Read binary files
Command: strings
Count the number of files in a directory
Command: ls –1
wc –l
How to delete a directory with too many files
When you get the message: “rm * Arguments too long.”
This means that there are too many files in the directory.
Delete all files with XXXX:
Command: # find .
grep “XXXX”
xargs rm –f
Remove all files in the directory and sub-directories:
No comments:
Post a Comment