You are on page 1of 6

UNIX - USEFUL COMMANDS

http://www.tuto rialspo int.co m/unix/unix-use ful-co mmands.htm


Co pyrig ht tuto rials po int.co m

T his quick g uide lists commands, including a syntax and brief description. For more detail, use:
$man command

Files and Directories:


T hese commands allow you to create directories and handle files.

Command cat cd chg rp chmod cp file find g rep head ln ls mkdir more mv pwd rm rmdir tail touch

Desc ription Display File Contents Chang es Directory to dirname chang e file g roup Chang ing Permissions Copy source file into destination Determine file type Find files Search files for reg ular expressions. Display first few lines of a file Create softlink on oldname Display information about file type. Create a new directory dirname Display data in pag inated form. Move (Rename) a oldname to newname. Print current working directory. Remove (Delete) filename Delete an existing directory provided it is empty. Prints last few lines in a file. Update access and modification time of a file.

Manipulating data:
T he contents of files can be compared and altered with the following commands.

Command awk

Desc ription Pattern scanning and processing lang uag e

cmp comm cut diff expand join perl sed sort split tr uniq wc vi vim fmt spell ispell ispell emacs ex, edit emacs emacs

Compare the contents of two files Compare sorted data Cut out selected fields of each line of a file Differential file comparator Expand tabs to spaces Join files on some common field Data manipulation lang uag e Stream text editor Sort file data Split file into smaller files T ranslate characters Report repeated lines in a file Count words, lines, and characters Opens vi text editor Opens vim text editor Simple text formatter Check text for spelling error Check text for spelling error Check text for spelling error GNU project Emacs Line editor GNU project Emacs GNU project Emacs

Compressed Files:
Files may be compressed to save space. Compressed files can be created and examined:

Command compress g unzip g zip uncompress unzip

Desc ription Compress files Uncompress g zipped files GNU alternative compression method Uncompress files List, test and extract compressed files in a Z IP archive

zcat zcmp zdiff zmore

Cat a compressed file Compare compressed files Compare compressed files File perusal filter for crt viewing of compressed text

Getting Information:
Various Unix manuals and documentation are available on-line. T he following Shell commands g ive information:

Command apropos info man whatis yelp

Desc ription Locate commands by keyword lookup Displays command information pag es online Displays manual pag es online Search the whatis database for complete words. GNOME help viewer

Network Communication:
T hese following commands are used to send and receive files from a local UNIX hosts to the remote host around the world.

Command ftp rcp rlog in rsh tftp telnet ssh scp sftp

Desc ription File transfer prog ram Remote file copy Remote log in to a UNIX host Remote shell T rivial file transfer prog ram Make terminal connection to another host Secure shell terminal or command connection Secure shell remote file copy secure shell file transfer prog ram

Some of these commands may be restricted at your computer for security reasons.

Messag es between Users:


T he UNIX systems support on-screen messag es to other users and world-wide electronic mail:

Command

Desc ription

evolution mail mesg parcel pine talk write

GUI mail handling tool on Linux Simple send or read mail prog ram Permit or deny messag es Send files to another user Vdu-based mail utility T alk to another user Write messag e to another user

Prog ramming Utilities:


T he following prog ramming tools and lang uag es are available based on what you have installed on your Unix.

Command dbx g db make nm size strip cb cc ctrace g cc indent bc g cl perl php py asp CC g ++ javac appletvieweir netbeans

Desc ription Sun debug g er GNU debug g er Maintain prog ram g roups and compile prog rams. Print prog ram's name list Print prog ram's sizes Remove symbol table and relocation bits C prog ram beautifier ANSI C compiler for Suns SPARC systems C prog ram debug g er GNU ANSI C Compiler Indent and format C prog ram source Interactive arithmetic lang uag e processor GNU Common Lisp General purpose lang uag e Web pag e embedded lang uag e Python lang uag e interpreter Web pag e embedded lang uag e C++ compiler for Suns SPARC systems GNU C++ Compiler JAVA compiler JAVA applet viewer Java integ rated development environment on Linux

sqlplus sqlldr mysql

Run the Oracle SQL interpreter Run the Oracle SQL data loader Run the mysql SQL interpreter

Misc Commands:
T hese commands list or alter information about the system:

Command chfn chg rp chown date determin du echo exit fing er g roupadd g roups homequota iostat kill last log out lun netstat passwd passwd printenv ps ps quota -v reset

Desc ription Chang e your fing er information Chang e the g roup ownership of a file Chang e owner Print the date Automatically find terminal type Print amount of disk usag e Echo arg uments to the standard options Quit the system Print information about log g ed-in users Create a user g roup Show g roup memberships Show quota and file usag e Report I/O statistics Send a sig nal to a process Show last log ins of users log off UNIX List user names or log in ID Show network status Chang e user password Chang e your log in password Display value of a shell variable Display the status of current processes Print process status statistics Display disk usag e and limits Reset terminal mode

script script setenv stty time top tset tty umask uname uptime useradd users vmstat w who

Keep script of terminal session Save the output of a command or process Set environment variables Set terminal options T ime a command Display all system processes Set terminal mode Print current terminal name Show the permissions that are g iven to view files by default Display name of the current system Get the system up time Create a user account Print names of log g ed in users Report virtual memory statistics Show what log g ed in users are doing List log g ed in users