Simple UNIX commands

Simple UNIX commands

[Return to tutorial page] [Return to main page]

ls

Lists the files found in the file system.

ls [flags] filelist

[flags]
  • -A Shows all files including hidden files and does not show current (.) and parent directory (..).
  • -a Shows all files including hidden files and shows the current (.) and parent directory (..).
  • -C Columnar output, sorted down the columns.
  • -x Columnar output, sorted across the columns.
  • -d Treats each entry as a directory.
  • -l Gives the long listing - details about each file is displayed.
  • -t Sorts by the time last modified. Used with the -l flag.
  • -u Sorts by the time last accessed. Used with the -l flag.
  • -c Sorts by the time the i-node information last changed. Used with the -t flag.
  • -r Reverses the sort order.
  • -i Shows the i-node number of the ffile in the first column.
  • filelist - A space seperated list of files and directories to list
    Suggested options
  • ls - Simplest output - just displays the normal files and directories.
  • ls -la - Displays the details about all the files.

  • [
    Return to the index] [Return to tutorial page] [Return to main page]

    cd

    Changes the current working directory.

    cd dirname

    dirname - Changes to an optional directory name. If no directory is specified, the user is returned to his home directory.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    cp

    Copies files. You may copy one file to another, or a list of files to a directory.

    cp source-file dest-file

    cp source-list dest-directory

    source-file - The file to copy
    dest-file - The destination filename. This maybe a directory name, in which case the source file name is appended to the directory
    source-list - A space seperated list of files to copy
    dest-directory - The destination directory

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    mv

    Renames a file or moves it to a new direcory, or both. mv also allows you to rename a directory.

    mv [flags] file1 file2

    mv [flags] dir1 dir2

    mv [flags] filelist dir

    flags
  • -f Normally mv prompts you if the destination file exists and write permissoins are turned off. This causes mv to move without prompting.
  • file1 - The source file name
    file2 - The destination file name (new name)
    dir1 - The source directory name
    dir2 - The destination directory name (new name)
    filelist - A space seperated list of files to move. Names are retained.
    dir - The destination directory.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    rm

    Removes files and intire directory structures from the file system.

    rm [flags] filelist

    flags
  • -f Specifies forced mode. Normally rm prompts you if you don't have permissions to delete the file. This forces the file to be removed without your involvement.
  • -r Deletes the directories specified in filelist. Directories are only deleted if the -r flag is specified.
  • -i Specifies interactive mode. You are prompted before the removal takes place.
  • -- Indicates the end of all options.
  • filelist - A space seperated list of files you want to delete. It may contain directory names as well.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    mkdir

    Creates directories.

    mkdir [flags] dirnames

    flags
  • -m mode Sets the directory permissions to mode at the time of creation.
  • -p Creates all non-existant parent directories.
  • dirnames - The path of the directory to be created

    [
    Return to the index][ [Return to tutorial page] [Return to main page]

    rmdir

    Removes directories.

    rmdir [flags] dirlist

    flags
  • -p Causes rmdir to delete any parent directories that also become empty.
  • -s Suppress the message when the -p option is active.
  • dirlist - A space seperated list of directory names. Directories must be empty to be deleted

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    exit

    Exits from the current shell.

    exit


    [
    Return to the index] [Return to tutorial page] [Return to main page]

    more

    More is a general purpose pager. It is used to view text files that scrolls off the screen.

    more [flags] filenames

    flags
  • -n n is an integer used to set the window size - number of lines on the screen
  • -c
  • -d Changes the default more prompt
  • -f Counts logical lines rather than screen lines
  • -l
  • -r Shows carriage returns as ^M
  • -v Shows all control characters as ^x, where x is the character used to generate it.
  • -s Multiple blank lines are suppressed and treated as one.
  • -w Waits at the end of file fir usersupplied control to quit, rather than just exiting.
  • filelist - A space seperated list of file names.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    man

    NOT YET DONE!!!

    man


    [
    Return to the index] [Return to tutorial page] [Return to main page]

    cat

    Concatenates files. This is sometimes used to display a file.

    cat [flags] filelist

    flags
  • -s Suppresses messages about unreadable files.
  • -u Causes the output to be unbuffered.
  • -v Shows all control characters as ^x, where x is the character used to generate it.
  • -t Used with the -v option this causes tabs and formfeeds to be displayed in the ^x format.
  • -e Used with the -v option this causes newlines to be followed by a $ sign
  • filelist - A space seperated list of file names to be concatenated. If none is given then stdin is used.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    grep

    NOT YET DONE!!!

    grep


    [
    Return to the index] [Return to tutorial page] [Return to main page]

    passwd

    Allows a user to change their passwd.

    passwd username

    username - Changes the passwd of the user username.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    ps

    NOT YET DONE!!!

    ps [flags]


    [
    Return to the index] [Return to tutorial page] [Return to main page]

    kill

    Allows you to send a signal to a process that is currently running. Usually this command is used to cause the process to stop executing.

    kill -signal pid

    -signal The signal that is going to be sent.
    pid The process ID of the process you want to send the signal to.

    [
    Return to the index] [Return to tutorial page] [Return to main page]

    su

    NOT YET DONE!!!

    su [flags]


    [
    Return to the index] [Return to tutorial page] [Return to main page]
    Page last updated by John-Lucas Brown 03-Apr-1997