Wednesday 20 February 2013

Few Basic UNIX commands

Here are some very basic UNIX commands that will help you to use a good start to your UNIX command line adventures. Some of the commands given here may be different on non-Solaris systems.
  • ls — List your files
    ls -l — lists your files in ‘long format’, which contains lots of useful information, e.g. the exact size of the file, who owns the file and who has the right to look at it, and when it was last modified.
    ls -a — lists all files, including the ones whose filenames begin in a dot, which you do not always want to see.
    There are many more options, for example to list files by size, by date, recursively etc.
  • cd – Change directories
    Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.
     

  • mv- Change the name of a directory
    Type mv followed by the current name of a directory and the new name of the directory.
    Ex: mv testdir newnamedir


  • passwd – Change your current password
    Type passwd and press enter. You’ll see the message Changing password for yourname.
    At the Old password: prompt, type in your old password .
    Then, at the Enter new password: prompt, type in your new password .
    The system double checks your new password. Beside the Verify: prompt, type the new password and press again.


  • pwd – Print working directory
    will show you the full path to the directory you are currently in. This is very handy to use, especially when performing some of the other commands on this page


  • rmdir – Remove an existing directory
    rm -r
    Removes directories and files within the directories recursively.


  • chmod – Change file access permissions
    Usage
    chmod [-r] permissions filenames
    r Change the permission on files that are in the subdirectories of the directory that you are currently in. permission Specifies the rights that are being granted. Below is the different rights that you can grant in an alpha numeric format.filenames File or directory that you are associating the rights with Permissions.
    u – User who owns the file.
    g – Group that owns the file.
    o – Other.
    a – All.
    r – Read the file.
    w – Write or edit the file.
    x – Execute or run the file as a program.


  • man – Pull up information about a Linux command
    Type man followed by a command to get detailed information about how to use the command.
    Ex:man ls


  • lpr – Print file from UNIX
    Use the -p option to specify the printer name if you want to use a printer other than your default printer. For example, if you want to print double-sided, use ‘lpr -Pvalkyr-d’.


  • logout – quit using the system
    Logout command will log your account out of the system.

No comments:

Post a Comment