Tuesday 25 September 2012

UNIX Commands


1. Files

1.1. Filename Substitution
Wild Cards                                                                                 ? *
Character Class (c is any single character)                                   [c…]
Range                                                                                         [c-c]
Home Directory                                                                          ~
Home Directory of Another User                                                 ~user
List Files in Current Directory                                                      ls [-l]
List Hidden Files                                                                         ls -[l]a

1.2. File Manipulation
Display File Contents                                                                 cat filename
Copy                                                                                         cp source destination
Move (Rename)                                                                         mv oldname newname
Remove (Delete)                                                                        rm filename
Create or Modify file                                                                  pico filename

1.3. File Properties
Seeing Permissions                                                                     ls -l filename
Changing Permissions                                                                chmod nnn filename
                                                                                                 chmod c=p…[,c=p…] filename
n, a digit from 0 to 7, sets the access level for the user (owner), group, and others (public), respectively.
c is one of: u–user; g–group, o–others, or a–all. p is one of: r–read
access, w–write access, or x–execute access.
Setting Default Permissions                                                       umask ugo
ugo is a (3-digit) number. Each digit restricts the default permissions for the user, group, and others, respectively.
Changing Modification Time                                                     touch filename
Making Links                                                                           ln [-s] oldname newname
Seeing File Types                                                                     ls -F

1.4. Displaying a File with less
Run less                                                                                   less filename
Next line                                                                                  RETURN
Next Page                                                                                SPACE
Previous line                                                                             k
Previous Page                                                                           b

1.5. Directories
Change Directory                                                                      cd directory
Make New Directory                                                                mkdir directory
Remove Directory                                                                     rmdir directory
Print Working (Show Current) Directory                                    pwd

No comments:

Post a Comment