How to find CPU & Memory detail of linux
How to find if any service is listening on particular port or not ?
For example if you know that tomcat is running on 8080 port so to check if tomcat service is listening or not then use
How to sort files based on Size of file ? ( useful to find large files in log directory to delete in case disk is full )
How to delete files older than N number of days ? (Useful in delete log, trace, tmp file )
How to create symbolic link to a file ?
e.g. If you want to create symbolic link from a -> b
(Condition:you should have file b in that directory & there should not be any file with name a)
How to find the Unix/Linux version of a particular host ?
How to set/unset line numbers in vi editor?
To set line number
To unset line number
Total number of files in particular directory
How to set an alias for complex/different commands?
/Proc file system - Various Kernel Statistics
/proc file system provides detailed information about various hardware devices and other Linux kernel information.
Search the particular key word content in a file
To make your search more faster if you know what type of files to be searche use the following
cat /proc/cpuinfo (CPU)
cat /proc/meminfo (Memory)
How to find if any service is listening on particular port or not ?
netstat -an grep {port no}
For example if you know that tomcat is running on 8080 port so to check if tomcat service is listening or not then use
netstat -an grep 8080
How to sort files based on Size of file ? ( useful to find large files in log directory to delete in case disk is full )
ls -l sort -nrk 5 more
How to delete files older than N number of days ? (Useful in delete log, trace, tmp file )
find . -name ‘*.*’ -mtime +[N in days] -exec rm {} \;
( This command will delete files older then N days in that directory, always good to use it when you are in applcsf/ tmp,out,log directory)How to create symbolic link to a file ?
ln -s pointing_to symbolic_name
e.g. If you want to create symbolic link from a -> b
ln -s b a
(Condition:you should have file b in that directory & there should not be any file with name a)
How to find the Unix/Linux version of a particular host ?
uname -a
How to set/unset line numbers in vi editor?
To set line number
:set number
To unset line number
:set nonumber
Total number of files in particular directory
find /usr/local/perl-5.10.1 -ls wc -l
How to set an alias for complex/different commands?
alias l=“ls –alF”
alias cls=clear
/Proc file system - Various Kernel Statistics
/proc file system provides detailed information about various hardware devices and other Linux kernel information.
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/zoneinfo
cat /proc/mounts
Search the particular key word content in a file
grep -iR <phrase>
< phrase >
-> word you want to search if you want to search a sentence enclose within '' (single quotes)To make your search more faster if you know what type of files to be searche use the following
find -iname "*.xml" | xargs grep -iR <phrase>
Disk Usage listing with depth one level depth:
du -h --max-depth=1 .
No comments:
Post a Comment