Custom Search

Unix Basic Commands

<< Back to Main Page                    << Back to UNIX Page


Page1 Page2 Page3


login : Ask for login name(also known as username) followed by password.

___________________________________________________________________________________________


passwd : To change existing password. Prompt for old password followed by new password.

___________________________________________________________________________________________


clear : Clear terminal screen.

___________________________________________________________________________________________


exit : This command ends Unix session.

___________________________________________________________________________________________


uname : Display information about computer system; set node name (system name).

___________________________________________________________________________________________


id : The id command writes a message to standard output, giving the user and group IDs and names for the process.
Various options are available with this command.
-u : Display only the user ID.
-n : With -u, -g, or -G, display the name instead of the ID number.

i.e. id -nu

___________________________________________________________________________________________


whoami : Prints your current user name. Gives you same result as id -nu.

___________________________________________________________________________________________


ps : Prints information about selected processes.
Various options are available with this command.
-A : Select all processes
-e : Select all processes (Same as A)
-f : Show columns user, pid, ppid, cpu, stime, tty, time, and args, in that order.

i.e. ps -ef

___________________________________________________________________________________________


kill : The kill command sends a signal to each process specified by a pid process identifier to terminate the process.

___________________________________________________________________________________________


du : This command is used to give summarize disk usage in 512-byte block.
Various options are available with this command.
-a : Print entries for each file encountered in the directory hierarchies in addition to the normal output.
-k : Gives the block count in 1024-byte blocks.
-s : Print only the grand total of disk usage for each of the specified name operands.

___________________________________________________________________________________________


df : Report number of free file system disk blocks in 512-byte.
Various options are available with this command.
-k : Report the allocation in kilobytes (KB).

i.e. df -k (Gives alocation, free, used space in KB for all file system device)
df -k . (Gives alocation, free, used space in KB for current file system device)

___________________________________________________________________________________________


history : Display the list of commands that you have previously typed.

___________________________________________________________________________________________


export : Declare variable at Unix session level so that it can be accessable in any script/command within the session.
i.e. x=10 (This will assign value 10 to variable x. This variable cannot be use in shell script or any other command)
export x (Now this variable is available to use in shell script as well as any other command)
export x=10 (another way to declare variable)

___________________________________________________________________________________________


unset : Undeclare existing variable.
i.e. unset x

___________________________________________________________________________________________


echo : writes its arguments separated by blanks and terminated by a new-line on the standard output.
It is also used to print the content of environment variable.
i.e. echo "Test"
echo $SHELL

___________________________________________________________________________________________


alias : Alias command is used to define shortcut for unix commands.
i.e. alias list='ls -lrt'
list will return same result as ls -lrt.

___________________________________________________________________________________________


unalias : Unalias command is used to undefine shortcut.
i.e. unalias list='ls -lrt'
list: not found

___________________________________________________________________________________________


head : This command gives first few lines.
      Syntax : head [-count] [file ...]
If returns first "count" lines of file. If count is omitted, it returns first 10 lines default.
Example:
head -25 test.dat
head test.dat (returns 10 lines)

___________________________________________________________________________________________


tail : This command gives last few lines.
      Syntax : tail [-count] [file ...]
If returns last "count" lines of file. If count is omitted, it returns first 10 lines default.
Example:
tail -25 test.dat
tail test.dat (returns last 10 lines)

___________________________________________________________________________________________


expr : evaluate arguments as an expression.
expr takes arguments as an expression, evaluates, then writes the result on the standard output.
Terms in the expression must be separated by blanks.
i.e. expr 5 + 10 (returns 15)



Page1 Page2 Page3


<< Back to Main Page                    << Back to UNIX Page