Unix Command Line Cheat Sheet

by Troy Grosfield
February 24th, 2012

Here are some unix commands I find useful.

Display All Running Processes

$ ps aux

Limit to only look at celeryd processes:

$ ps aux | grep celeryd

List Contents of a Directory including Hidden Files/Folders:

$ ls -l -a


Find all files with some text in the file:

find . -exec grep -l "some text to search for" {} \;

Make Directory and All Subdirectories

Will create all folders that haven’t already been created in the directory path:

$ mkdir -p /some/new/folder/path

Change File/Folder Permissions

Make a File Executable:

$ chmod +x /path/to/file

Change file permission so only owner can execute and everyone else can read:

$ chmod 744 /path/to/file

chmod permissions:

0 = no permissions; can't read, write, or execute file
1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)

Display Hard Disk Partition Size

$ df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/xvda1              11G   7.7G   2.4G  77% /
none                    18G   140k    18G   1% /dev
none                    18G    66k    18G   1% /dev/shm
none                    18G    91k    18G   1% /var/run
none                    18G      0    18G   0% /var/lock
/dev/xvdb              888G   210M   843G   1% /mnt

Display Free Memory in Megabytes

$ free -m
            total      used      free    shared   buffers    cached
Mem:        34306     13305     21000         0       188     11308
-/+ buffers/cache:     1809     32496
Swap:           0         0         0
1 Comment »

One Comment

Leave a reply

You must be logged in to post a comment.

  1. Author
    shiv kumar suman
    May 28th, 2012 at 1:46 am

    good but i want complete commands about unix