Differences

This shows you the differences between the selected revision and the current version of the page.

technology:unix:useful_commands 03.15.2010 10:12 technology:unix:useful_commands 03.18.2013 05:53 current
Line 1: Line 1:
====== Useful commands ====== ====== Useful commands ======
<code shell> <code shell>
-top                                            ; shows running processes; 'c' = see process details; 'q' = quit; '1' = show processor cores; 'k' = kill a process+= Performance = 
 +top                                            ; shows running processes;  
 +                                                'c' = see process details; '1' = show processor cores; 'k' = kill a process 
 +                                                'A' = show many windows; 'a,w' = navigate windows; 'z' = color; 'x' = highlight sort col 
 +                                                shift-w = save it too your .toprc 
 += Finding Stuff = 
 +find / -name "file_name" -print                ; find file name from root directory path (/) 
 +find . -user root                              ; find files owned by root user, in current directory (.) 
 +locate -i fstab                                ; find file name in database that keeps track of filenames 
 +find . -type f -user zenoss -name "*.py" -exec grep -il "blah" {} \; 
 +                                                ; find text "blah" in .py files belonging to zenoss user 
 +locate Data.fs | xargs ls -l                    ; xargs to pipe results of one command to another 
 +find ./ -name '*py' | xargs grep signal        ; Find string "signal" inside text of .py files; xargs looks inside the files instead of at the file name 
 +grep -ir "timeout" .                            ; find the string "timeout" in any file below the current dir 
 + 
 += Various =
screen                                          ; lets you share screens with other people screen                                          ; lets you share screens with other people
nano                                            ; text editor that lets you use modern keyboard keys nano                                            ; text editor that lets you use modern keyboard keys
Line 13: Line 28:
wget <http url>                                ; download a file from the web wget <http url>                                ; download a file from the web
sar                                            ; system activity reporter sar                                            ; system activity reporter
-find / -name "file_name" -print                ; find file name from root directory path (/) 
-find . -user root                              ; find files owned by root user, in current directory (.) 
-locate -i fstab                                ; find file name in database that keeps track of filenames 
-find . -type f -user zenoss -name "*.py" -exec grep -il "blah" {} \; 
-                                                ; find text "blah" in .py files belonging to zenoss user 
-locate Data.fs | xargs ls -l                    ; xargs to pipe results of one command to another 
- 
du -k ~ | more                                  ; show disk usage (useful for over quota) for home directory du -k ~ | more                                  ; show disk usage (useful for over quota) for home directory
Line 50: Line 58:
-File System Manipulation+= File System Manipulation =
fuser -m /dev/md0                              ; shows processes being used by device fuser -m /dev/md0                              ; shows processes being used by device
lsof /media/documents/                          ; show list of files open lsof /media/documents/                          ; show list of files open
lsof / | grep media                            ; in case above doesnt work, lsof seems to work better on root and then grep it out for what you need lsof / | grep media                            ; in case above doesnt work, lsof seems to work better on root and then grep it out for what you need
 +lsof +D /var/log/                              ; list of files open under the given directory (recursive) (use +d for non-recurse)
-Network Information+= Network Information =
nslookup 10.175.211.10                          ; reverse DNS lookup; gives the hostname associated with the IP nslookup 10.175.211.10                          ; reverse DNS lookup; gives the hostname associated with the IP
host -a www.google.com                          ; DNS lookup; gives IP associated with the hostname (verbose) host -a www.google.com                          ; DNS lookup; gives IP associated with the hostname (verbose)
Line 65: Line 74:
tcpdump port 80 or port 443                    ; shows traffic in and out on http and https tcpdump port 80 or port 443                    ; shows traffic in and out on http and https
echo “newhostname” > /proc/sys/kernel/hostname  ; set new hostname on CentOS / RedHat echo “newhostname” > /proc/sys/kernel/hostname  ; set new hostname on CentOS / RedHat
 +netstat -rn                                    ; routing table
-Package Management+= Package Management =
rpm -qa                                        ; Packages installed on system rpm -qa                                        ; Packages installed on system
 +rpm -qa | grep httpd*                          ; See if httpd is installed
 +yum list installed httpd                        ; See if httpd is installed
yum provides /etc/fstab                        ; name of the package which contains a particular file yum provides /etc/fstab                        ; name of the package which contains a particular file
yum list                                        ; lists information about available packages yum list                                        ; lists information about available packages
yum install gnote                              ; install gnote and all its dependancies yum install gnote                              ; install gnote and all its dependancies
 +patch < /patch/to/apply.diff
 +patch -R --dry-run --verbose < patch.diff      ; undo / backout a patch
 +yast                                            ; opensolaris / SLES package manager
</code> </code>
 
technology/unix/useful_commands.1268662321.txt.gz · Last modified: 04.01.2010 18:32 by nyeates1
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki