TroyGrosfield.com TroyGrosfield.com

Headline

Unix Command Line Cheat Sheet

Author
by Troy Grosfield
Date
February 24th, 2012
Category
Developer
Story

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

Searching

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
Tags
Comments
1 Comment »

One Comment

Leave a reply

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

    good but i want complete commands about unix