Thursday, January 31, 2013

Most Useful Unix Commands

Passwd        : Change user password
Pwd      : print working Directory
Cd                 :  Change directory
Ls           : list of files in a directory
Wildcards   : * matches any number of    
                       characters, ‘?’ matches a single  
                        character
File        : print the type of file
Cat                : Displays the content of the file
Pr          : Displays the contents of a file
pg or page   : Display the contents of a file one  
                       page at a time
More    : Display the contents of a file one  
                        page at a time
Clear             : Clears the screen
Cp or
Copy     : copy a file
Chown          : Change the owner of a file
chgrp    : Change the group of a file
chmod          : Change file modes, permissions
rm         : Remove a file from the system
mv                 : Rename a file
mkdir   : Create a directory
rmdir            : Remove a directory
grep      : Pattern matching
Egrep             : grep command for extended  
                        regular expressions
find       : Used to locate files and directories
>>                  : Append to the end of a file
>            : Redirect, create, or overwrite a
                         file
|                    : Pipe, used to string commands
                         together

||         : Logical OR—command1 ||command2
               —execute command2 if command1  
               fails
&                : Execute in background

&&       : Logical AND—command1 &&  
               command2—execute  command2 if  
               command1 succeeds
date         : Display the system date and time
echo    : Write strings to standard output
sleep   : Execution halts for the specified
                number of seconds
wc       : Count the number of words, lines,
                and characters in a file
head    : View the top of a file
tail       : View the end of a file
diff      : Compare two files

sdiff     : Compare two files side by side
                (requires 132-character display)
spell    : Spell checker
lp, lpr,
enq, qprt : Print a file
lpstat :Status of system print queues
enable  : Enable, or start, a print queue
disable : Disable, or stop, a print queue
rwall    : Display a message to all users on a  
                remote host
rsh or remsh
            : Execute a command, or log in, on a
                remote host
df         : File systems statistics

ps        : Information on currently running
               processes
netstat  : Show network status

vmstat   :Show virtual memory status
cal       : Display a calendar
who     : Display information about users on
                the system
w         : Extended who command
whoami : Display $LOGNAME or $USER
                 environment parameter

who am I : Display login name, terminal, login
                    date/time, and where logged in

f, finger : Information about logged-in users
                 including the users .plan and .project
talk      : Two users have a split screen
                conversation
write   : Display a message on a user’s screen

wall     : Display a message on all logged-in
               users’ screens
iostat : Show input/output status
uname : Name of the current operating
                system, as well as machine
               information
sar       : System activity report

basename : Base filename of a string
                       parameter
man     : Display the on-line reference manual

su        : Switch to another user, also known as
                super-user
cut       : Write out selected characters

awk     : Programming language to parse
                characters
sed      : Programming language for character
                substitution
vi         : Start the vi editor
emacs : Start the emacs editor
`command` :  Command substitution
( )          : Run the enclosed command in a sub-
                  shell
(( ))       : Evaluate and assign value to variable
                and do math in a shell
$(( ))     : Evaluate the enclosed expression
[ ]          : Same as the test command
[[ ]]       : Used for string comparison
$( )        : Command substitution


Chmod Permissions

4000
Sets user ID on execution
2000
Sets group ID on execution
1000
Sets the link permission to directories or sets the save-text attribute for files.
0400
Permits read by owner
0200
Permits write by owner
0100
Permits execute or search by owner
0040
Permits read by group
0020
Permits write by group
0010
Permits execute or search by group
0004
Permits read by others
0002
Permits write by others
0001
Permits execute or search by others

No comments:

Post a Comment