Unix Command Line Stuff Worth Remembering

Author:
phil
Created:
Thursday, April 05th, 2012
Last Updated:
Monday, February 11th, 2013

Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service


Here you will find a list of different UNIX style commands that come in handy while operating a *NIX based operating system. I personally am not a big fan of command line stuff considering the advancements in technology make it completely dated, however others in the community will heavily disagree...

Since I have to do some UNIX / Linux type of stuff now and again, I have compiled a list of commands that I don't feel like remembering because I use them maybe once every six months.

Initial Great Resource: 20 Linux System Monitoring Tools Every SysAdmin Should Know

This list is an on-going process.


Recursive chmod only files within this folder:
find . -type f -exec chmod 0600 {} \;

Recursive chmod only folders within this folder:

find . -type d -exec chmod 0755 {} \;


Tar a file directory
tar -czvf [name-of-tarfile].tar.gz [name-of-file/directory]

Un-Tar a file

tar -zxvf [name-of-tarfile].tar.gz [name-of-file/directory]

Statistics & Monitoring

Show Virtual Memory Stats (wait 5 seconds show 2 rows)

vmstat 5 2

Show I/O info (-x extended info -m megabytes wait 5 seconds show 2 rows)

iostat -xm 5 2

Shows the "multiprocessor" CPU usage and status

mpstat -P ALL


Find a string of text within a file (More found here)
find . -type f -exec grep -l "string-to-find" {} +


Show Info about the running processes for logged-in user
for k in $(pgrep -u $USER | awk '{print $1}') ; do echo ======== PID: $k ; cat /proc/$k/environ | tr '\000' '\n'  ; done

Post Comment