UNIX Skills (I)

Sun Yu, 2001
1. Introduction to UNIX
  • Three parts of UNIX
  • Good features of UNIX
  • 2. UNIX commands
  •   Login and Logout
  • "yppasswd" (change password)
  •   wild cards (save typing, make commands more flexible)
  • "mkdir directoryname" (create a directory)
  • "rmdir directoryname (remove an empty directory)
  • "pwd" (show which directory you are currently in)
  • "cd directoryname" (go to the indicated directory)
  • "ls" (get a list of files in an indicated directory)
  • "cat filename" (dump a file to the screen)
  • "more filename", "head", "tail" (show a file one screen full at a time, or the specified lines)
  • "cp source-filename1(2...) destination"  (copy files to an indicated destination)
  • "mv source-filename destination" (move a file to a new location; rename a file)
  • "rm filename(s)" (remove a file(s))
  •   redirection (redirect output of a command to another file)
  •   pipe (make output of one command input of another)
  • "chmod" (change access permission of files)
  • "finger" (get information on specified users)
  • "ps", "who", "kill", "top" (process control)
  • "man command" (provide detailed online information of all commands)
  • "du", "df", and "diff" (file system)
  • "module" (interface to module packages)
  • "find" (find a file in the system)
  • "uname" (check what Operating System you are running on)
  • "wc -lwc filename" (count the number of lines, words, and characters in a file)
  • "file filename" (report file types)
  • "groups userID" (display a list of the groups you are a member of)
  • Other useful commands
  • 3. UNIX's file system 4. UNIX's process control 5. Editing 6. Printing

    7. Internet

    8. X11 Window System 9. More 10. More UNIX tutorials & UNIX links



    Introduction

    UNIX is a powerful operating system that was created in the late 1960s, in an effort to provide a multi-user, multitasking system for use by programmers. The philosophy behind the design of UNIX was to provide simple, yet powerful utilities that could be pieced together in a flexible manner to perform a wide variety of tasks. One good point of UNIX is its "portability", which means that UNIX of various versions could be run on different computer platforms such as Sun Sparc, SGI, and Intel x86.

    The UNIX operating system comprises three parts: the kernel, the standard utility programs, and the system configuration files.

    Though UNIX does not seem quite user friendly as Windows98, UNIX has several good aspects such as it is more efficient at handling multiple users. Simply speaking, the features of UNIX are:
  • Multitasking

  • UNIX is capable of running multiple programs for multiple users simultaneously.
  • Multi-user

  • Multiple people can log in one workstation running UNIX to work on their own files and programs. This is supported because UNIX is a timesharing system, which means that the processes (a process is an instance of running a program.) take turns running. Each turn is a called a timeslice. UNIX determines the sizes of timeslices for each process.
  • Powerful network ability

  • In effect, most of the internet "backbone" is run using UNIX servers of one sort or another. UNIX can be configured to allow users to communicate effectively with other machines on the network.
    For example, users can remotely log in a UNIX workstation. Thus, at any given time one workstation can be used by multiple users who may be in different geographical locations.
    Another example is file sharing. Unix is able to share files (sources) with other machines over the network.


    UNIX commands

    For users familiar with Dos or Windows, the UNIX shell commands seem cryptic. When logging in to a UNIX system, you are placed in a program called the shell. A shell is a program that inputs Unix commands from the keyboard and relays them to the Unix system (the kernel) for execution. Shells typically include various shortcuts for users to use in stating their commands, and also a programming feature, in which users can make programs out of sets of their commands.

    *NOTE: different system vendors have different command options on machines.

    What happens when a command is typed?
            When we type a command, the shell reads the environment variable $path, which contains a list of directories containing program files. The shell looks
            through  this set of directories to find the program file for the command. The shell then passes the true filename to the kernel.
            Below are the elaboration of most commonly used commands that a good UNIX user should be familiar with.


    Login and logout.
      What happens when you log in and out?
              During login, when you type your username, getty issues a "password:" prompt to the monitor. After you type your password, getty calls login,
              which scans for a matching entry in the file /etc/passwd. If a match is made, login proceeds to take you to your home directory and then passes control
              to a session startup program; both the username and password are specified by the entry in /etc/passwd.
              (When you use a Bourne shell) From here, the shell program reads the files /etc/profile and .profile, which set up the system-wide and user-specific environment criteria. At this point,
              the shell issues a command prompt such as $.
              When the shell is terminated, the kernel returns control to the init program, which restarts the login process. Termination can happen in one of two
              ways:  with the exit command or when the kernel issues a kill command to the shell process. At termination, the kernel recovers all resources used by
              the user and the shell program.

    1. "yppasswd" - change password. (Refer to Kaszeta's document on "Secure Passwords" on page 15)


    2. "mkdir directoryname" - create a directory.


    3. "rmdir directoryname" - remove a directory (Note: the directory must be empty.). Alternatively, you can use "rm -r directorynaem".


    4. "pwd" - show which directory you are currently in.


    5. Wild cards. These will save you a lot of typing, and they make the commands more flexible. There are two wild-card characters in Unix: '*' and `?'.

    6. `*' - match with any string of characters. For example,
      "rm *.c"
      deletes all files in the current directory whose names end with `.c'.

      `?' - match with any single character. For example,

      "rm x?b.c"
      deletes all files whose names consisted of five characters, the first of which was `x' and the last three of which were `b.c'.  The files x3b.c and xrb.c would be deleted, while the file xuvb.c would not.

      In addition,
      '[0-9]' -  match character from `0' through `9'
      '[a-z]'  - match character from `a' through `z'
      For instance,

      "rm test[1-3].c"
      removes test1.c, test2.c and test3.c but not test4.c.

    7. "cd directoryname" - go to the indicated directory.

    8. "ls directoryname" - get a list of files in the indicated directory.
      1. Note: The options such as the above "-a", "-l", and "-F" can be used in combination. For example:

    9. "cat filename" - dump a file to the screen; "cat" command also can type out more than one file to the screen, for example,
    10. "cat filename1 filename2"
      shows you the content of both files on the screen. Actually "cat" is the abbreviation of the word 'concatenate'.

    11. "more filename" - similar to "cat" command in dumping a file to the screen, but dissimilar in that it allows you to page through a file, scrolling down through a file one screen full at a time. Therefore, it is better when a file is longer than the size of the window. For example,
    12. "more *.txt"
      shows the content of all the .txt files. Press space-bar to see the next page; press 'q' to quit reading; press return to see the next line."more file1 file2" can display the contents of multiples files sequentially.
      In addition, there are 3 commands related to the "more" command.

    13. "cp source-filename1 (souce-filename2) destination" - copy files to an indicated destination. For example,
    14. "cp test1.txt ~/ftp"
      copies the file test1.txt in the current directory to the subdirectory ftp of your home directory.
      "cp test1.txt new.txt"
      makes a copy of test1.txt, and name the newly created file new.txt. For multiple file copying, the destination part in the "cp" command has to be a directory rather than a file. For example,
      "copy *.c ~/ftp".
      Two useful options:

    15. "mv -i source-filename destination" - two functions: 1. move a file to another location (directory); 2. rename a file to a new name. For example,
    16. "mv -i ./sun.txt ~/ftp"
      moves the file sun.txt in the current directory to the subdirectory ftp of your home directory. The "-i" option prompts you for confirmation if the file sun.txt already exists in the ftp folder.  Another example is
      "mv sun.txt sun_new.txt"
      that changes the name sun.txt into sun_new.txt.
      "mv -i oldDirecotryName newDirectoryName" can either rename a folder or move a folder into another folder.

    17. "rm filename(s)" - remove a file(s).
    18. "rm -i filename(s)"
      is to have "rm" ask you about each file in case you delete something that you do not mean to.
      "rm -r directoryname"
      can work as "rmdir" to remove a directory.
      Two useful options:

    19. Redirection. Sometimes you will find it useful to save the output of a command. You can do this by redirecting the output to a file. For example,
    20. "ls > y"
      send the output of the "ls" command to a file y, instead of to the screen.

      By default, a command treats your terminal as the standard input file from which to read in information. Meanwhile, your terminal is also treated as the standard output file to which information is sent from the command.

      Redirection can change this default setup. To redirect the standard input for a command use '<' followed by the name of the input file. For example,

      "mail somebody@hotmail.com < sun.txt"
      mails the contents of sun.txt to the indicated E-mail address. Similarly,
      "sun.out > store"
      redirects the standard output of sun.out to the file store. If you do "more store", the result of sun.out will show up.
      Using redirection, we can use "cat > message.txt" to output its standard input from keyboard to create a file message.txt. This is useful to create a short text file.
      In sum,

    21. Pipes. Often it is useful to pipe the output of one command as input to another command. For example, you find the output of "ls" to be very long, zooming by on the screen before you have had a chance to read all of it. One solution to this problem would be to send the output to a file and then view the file as your leisure, but an easier, more direct method would be to pipe the output of "ls" into "more", i.e.
    22.      "ls | more"
      which would allow you to see the output of ls one screen at a time. You would hit the space bar whenever you are
      ready to go to the next screen. Another example is
      "more sun.txt | grep search-string"
      which output the results of sun.txt to "grep". "grep" command finds all lines within the input file sun.txt containing the search-string, and prints these line out. Of course you can redirect the printed out results to a file instead of display the results on the screen.
      Two more pipe example, "ls | wc -w" counts the number of files in the current directory; "who | wc -w" check the number of users on the system.

    23. "chmod" - change access permission of files. Refer to the file and directory system of UNIX below.


    24. "diff file1 file2"- compare the contents of file1 and file2 on a line-by-line basis.

    25. "diff directory1 directory2" - compare the contents of directory1 and directory2.

    26. "finger" - return information about users on the system.

    27. They may or may not be logged in. "finger" by itself returns the list of currently logged in users.
      "finger" followed by a username or an e-mail -style address, for example,
      "finger sunyu@umn.edu"
      will return information about the user sunyu, the last time they logged into the system where you are fingering them, their full name, whether or not they have unread mail and, finally, the contents of two files they may have created: .plan and .project


      Process control commands, such as "who", "ps", "top", "kill" and more.

    28. "man command" - provide detailed online information of all commands.

    29. Type
      "man command"
      which provides a detailed description of a specified UNIX command. For example,
      "man ls"
      lists all the usage, and options pertaining to "ls". Also, you can use
      "man man"
      to find more about the "man" command. 
    30. "find ~ -name filename" - find the file through the home directory.

    31. "find / -name filename" - find the file on the whole system.
      "find ~ -user yus" - find and display the files owned by the user "yus".
      "find ~ -group adv_microsys" - find and display the files owned by the group "adv_microsys".
      "find ~ -mtime -4" - find and display all the files that have been modified in the last 4 days.
      "find ~ -mtime +3" - find and display all the files that have not been modified in the last 3 days.
      "find /etc -type d" - find and display all the directories in /etc.
      "find /etc -type l" - find and display all symbolic linked files in /etc.
      "find ~ -size +1000000c" - find all files in the home directory that are OVER ("+") 1Mb; "c" indicates the size is in BYTE.
      "find ~ -size 100c" - find files that are exactly 100 bytes.
      "find ~ -size +10" - find files that are over 10 blocks ( 1 block = 512 bytes).
      More "find" options such as "cpio", and "xargs", refer to the man page.

    32. "uname" - return the Operating System type that you are running on.
    33. "wc -lwc filename" - count the number of lines, words, and characters. "-l" counts lines; "-w" words defined by a sequence of characters surrounded by tabs, and spaces; "-c" characters. 
    34. "file filename" reports the file type. 
    35. "groups userID" displays a list of all of the groups that you are a member of. The only way to create a new group is to ask the system administrator to add it.
    36. "uniq -c filename" displays the input file with all lines by only one occurrence (but not delete the lines). The "-c" option causes each line to be preceded by the number of occurrence. 
    37. "sort filename" - sort a file into ascending order; the order is based on the characters' ASCII values that can be listed by "man ascii";

    38. "sort -r filename" - sort a file into descending order;
      "sort +0 -1 filename" - sort first field only, specifying the starting field to be 0 and ending 1;
      "sort +0 -1 -bM filename" - sort first field only; "-b" option ignores leading spaces; and "-M" sorts the field in order by month. 
    39. "su username" - to create a temporary shell with "username" logging in. This is useful when a different user does something quick in his own account without having to have the current user logged out. If no username is specified, "su" assumes that "su root" is specified. 
    40. "ln file_to_be_linked label_file" - to create a hard link for a file. In a sense, now we have two copies of the file. Use "ls -l", the hard link count can be found. When changes are made to either file_to_be_linked or to label_file, both files are changed. Removing one file does not remove the other.

    41. "ln -s file_to_be_linked label_file" - to create a soft link (symbolic link). This could span file systems. Use "ls -a", you can find the label_file appended with @. We do not have two copies of the original file. When changes are made to the label file, we are actually changing the real file. If the real file is removed, the label file is empty.
    42. "biff" - instant mail notification. "biff" shows us if this utility is enabled. "biff y" enables it, and "biff n" disables it. 
    43. "crypt keystring <sunyu.txt> sunyu.crypt" creates a encrypted file sunyu.crypt from the file sunyu.txt (the file sunyu.txt is not removed). "keystring" is the key for decoding. To decode the file sunyu.crypt, use "crypt keystring <sunyu.crypt> sunyu.txt."



    44.  (Refer to Kaszeta's document on "UNIX command table" on page 13)


    File system
    1. Structure

    2. All the stored information on a UNIX computer is kept in a file system. Any time you interact with the UNIX shell, the shell considers you to be located somewhere within a file system. Although it may seem strange to be "located" somewhere in a computer's file system, the concept is not so different from real life. After all, you can't just be, you have to be somewhere. The place in the file system tree where you are located is called the current working directory.
    The UNIX file system is hierarchical (resembling a tree structure). The tree is anchored at a place called the root, designated by a slash "/". Every item in the UNIX file system tree is either a file, or a directory. A directory is like a file folder. A directory can contain files, and other directories. A directory contained within another is called the child of the other. A directory in the file system tree may have many children, but it can only have one parent. A file can hold information, but cannot contain other files, or directories.

    To describe a specific location in the file system hierarchy, you must specify a "path." The path to a location can be defined as an absolute path from the root anchor point, or as a relative path, starting from the current location. When specifying a path, you simply trace a route through the file system tree, listing the sequence of directories you pass through as you go from one point to another. Each directory listed in the sequence is separated by a slash(/). UNIX provides the shorthand notation of "." to refer to the current location, and ".." to refer to the parent directory.

    The first few levels of the hierarchical tree are illustrated below:
                                  /
    
                                  |
    
                        ---------------------
    
                       /     |    |    |     \ 
    
                     etc.    bin  usr  tmp    dev  
    
                             |                | 
    
                           ------          --------
    
                          /      \        /        \ 
    
                         ls ...  csh     ucb ...   lib
    Your own files form a subtree of this tree. Usually the user files are subdirectories of a directory named `home' within `usr'; if we had users Sun and Jim, for example, Sun's home directory would be /usr/home/sun, and all his files would be within that subtree, and the analogous statement would hold for Jim.

    Let us familiarize ourselves with an example. Suppose Sun's directory looks like this:

                                 Sun
    
                                  |
    
                        ----------------------
    
                       /     |     |    |     \
    
                     work  course ECE program ME
    
                             |                |
    
                           -----           --------
    
                          /     \             |
    
     Files:             VLSI   VHDL        control
    File names can be given either in relative terms, or with full path names. Look at the file `VLSI' above. If we are in the directory 'course', we can refer to this file as simply
    VLSI
    If we are in the directory above, i.e. the one named `Sun', then we must write
    course/VLSI
    If we are in the directory 'program', we can write either
    ../course/VLSI
    or
    ~/course/VLSI
    If we are not in any of Sun's directories, we can write
    ~Sun/course/VLSI or simply ~/course/VLSI
    Alternatively, in any case, the full path name will work:
    /usr/home/Sun/course/VLSI

    1. File types

    2. There are four types of files in the Unix file system.
      Naming UNIX files, it is legal to contain all numbers, all letters (both upper case and lower case), “. dot”, “_ underscore”, “- dash”. For example, 1.2.3 is a legal filename. Note that symbols such as # and $ are not allowed.


    3. File and directory permissions

    4. UNIX supports access control. Every file and directory has associated with it ownership, and access permissions. Furthermore, one is able to specify those to whom the permissions apply.

      Permissions are defined as read, write, and execute. The read, write, and execute permissions are referred to as r, w, and x, respectively. Those to whom the permissions apply are the user who owns the file, those who are in the same group as the owner, and all others. UNIX allows users to be placed in groups, so that the control of access is made simpler for administrators.The user, group, and others. Permissions are referred to as u, g, and o, respectively.



    Process control
    1. Unix processes

    2. A process is an instance of running a program. There can be more than one process running even with only person executing the program.

      Keep in mind that all Unix commands, for example, "cc" and "mail" are programs, and thus contribute processes to the system when they are running. If 10 users are running "mail" right now, that will be 10 processes. At any given time, a typical Unix system will have many active processes, some of which were set up when the machine was first powered up.

      Every time you issue a command, Unix starts a new process, and suspends the current process (the C-shell) until the new process completes (except in the case of background processes, to be discussed later).

      Unix identifies every process by a Process Identification Number (pid) which is assigned when the process is initiated. When we want to perform an operation on a process, we usually refer to it by its pid.

      Unix is a timesharing system, which means that the processes take turns running. Each turn is a called a timeslice; on most systems this is set at much less than one second. The reason this turns-taking approach is used is fairness: We don't want a 2-second job to have to wait for a 5-hour job to finish, which is what would happen if a job had the CPU to itself until it completed. 


    3. Determining status of current processes

    4. To check on running jobs, we can use:
      To cancel a process, type Control-c.
      To suspend a process (allowing it to be activated again), type Control-z. Using the command "fg" can always bring a suspended process back into foreground. 
    1. Foreground and background processes

    2. Suppose we want to execute a command but do not want to wait for its completion, i.e. we want to be able to issue other commands in the mean time. We can do this by specifying that the command be executed in the background.

      There are two ways to do this - put jobs in the background.

      1. Append an ampersand (`&') to the end of the command. For example, suppose you have a very large program, which will take a long time to compile. We could give the command
      2. "cc hugeprog.c &"
        which will execute the compilation while allowing you to submit other commands for execution while the compile is running. Another example is when we start a window during a X session. We would like to start the window from an existing window, but we still want to be able to use the original window. Then we execute the command
        "xterm &"
        This will start a new window, and allow us to keep using the current window.
      3. Use Control-z; when suspend it, note the jobid (the number in square brackets); use another command, "bg %jobid", to move the process to the background. For example, suppose we started our long-running compilation, "cc hugeprog.c" but we forget to append the ampersand. We can type Control-z to suspend/stop the job, and then type bg to resume the job in the background, allowing us to submit other commands while the compilation takes place. Unix will tell us when the background job has completed, with a statement like
      4. [1]    Done                 cc hugeprog.c
      Note: If you log out, whatever background processes you have running at the time will not be killed; they will continue to run. 
    3. Terminating a process

    4. "kill PID(process ID)" - terminate a process. We can find its PID by using the command "ps". "kill PID" gives the application a chance to exit gracefully, for example, clean up temp files. If "kill PID" does not work, you can always use
      "kill -9 PID"
      to kill a process in a forceful manner.

      If the process is in the foreground, though, the easiest way to kill it is to simply type Control-c.

      In sum,


    5. Run programs when you logged out

    6. When you exit a shell, all the background processes in the shell exit. To make a program(large computation) able to run even after you log out. Suppose sun.out is your executable file, then the following command may be used to achieve the goal - continue running even when log out.
      "nohup sun.out &"

      You can one example "nohup sleep 1000 &", then exit. Re-log in, "ps -ef" to find the process "sleep 1000."
      To ensure that all users make efficient use of limited resources, all background jobs submitted should be niced. Nicing a job reduces its priority level and preferentially allocates the CPU to interactive processes. Good thing is that in the absence of any other interactive or un-niced jobs, maximum CPU is allocated to the niced job.

      "nice +n nohup sun.out &"
      where n can be any number between 1 to 19. Higher the value of n, the lower the priority for the job.

      If you want to find more information on the command "nice", you should  'man csh' or 'man tcsh' instead of 'man nice'. This happens because the system '/usr/bin/nice' command uses a different syntax.

      Additionally,, if you already have jobs running (either in the foreground or in the background), you can 'renice' them with

      "renice +n pid"
      where "pid" is the process id of the process obtained from the "ps" command.


    Emacs
    1. General features of the Emacs editor

    2. Emacs is a visual editor. That means that you have a representation of your entire document on your screen, and you can move around freely, editing any part of the document you wish.

      Emacs uses Control and Esc characters to distinguish editor commands from text to be inserted in the buffer. In this document, the notation "Control-x" means to hold down the Control key, and type the letter x. You don't need to capitalize the x. "Esc -x" means to press the Esc key down, release it, and then type x


    3. Working with buffers

    4. When you edit a file in emacs, you're not really editing the file itself, as it sits out on a disk somewhere. Instead, emacs makes a copy of the file, and stores the copy in a part of memory(RAM) called a buffer. All the changes you make to the file are applied to the buffer. When you save the file, emacs writes the contents of the buffer to the disk. Because the buffer exists in memory(RAM), you should use the save command often, flushing your current buffer to disk. 
    5. Basic operations in emacs

    6. Type emacs & at the Unix prompt. The editor Emacs will be activated. If you want emacs to start with a file already loaded into a buffer, type emacs filename &.

      The display in emacs is divided into three basic areas. The top area is called the text window. The text window takes up most of the screen, and is where the document being edited appears. At the bottom of the text window, there is a single mode line. The mode line gives information about the document, and about the emacs session. The bottom line of the emacs display is called the minibuffer. The minibuffer holds space for commands that you give to emacs, and displays status information.

      Note: Control-g - If you typed the wrong thing, you can type this to kill/undo/abort the current command .

      Copy, cut and past


    Vi (Visual Editor)
    There are two modes: command mode and text-entry mode. To enter text-entry mode from command mode, press one of the keys listed in the following table.
    Key
    Action
    i
    Text is inserted before the cursor.
    I
    Text is inserted at the beginning of the current line.
    a
    Text is added after the cursor.
    A
    Text is added at the end of the current line. 
    o
    Text is added after the current line. 
    O
    Text is inserted before the current line. 
    R
    Text is replaced (overwritten).

    To switch from the text-entry mode to the command mode, press the ESC key at any time.
     

  • Range expression in Vi:

  • "$"- denote the line number of the last line in the file;
    "." - denote the line number of the currently containing the cursor.
    For example, :1,5d<enter> deletes line 1 to 3; :.,.+3d<enter> delete the current line and the 3 lines after it. The following table are some other examples of commands for line ranges.
    Range
    Selects
    1,$
    all of the lines in the line
    1,.
    all of the lines from the first line (included) to the current line (included)
    .,$
     all of the lines from the current line (included) to the last line (included)
    .-2
     the line that is two lines above the current line
  • Cursor movement:

  • Besides using the cursor keys, there are the following commands available.
    To line n
    :n<enter>
    To the start of a line
    ^
    To the end of a line 
    $
    Back one word
    the "b" key
    Forward one word 
    the "w" key
    Scroll down a half screen
    Control-d
    Scroll up a half screen
    Control-u
    Forward one screen
    Control-f
    Backward one screen
    Control-b
  • Deleting text:

  •  
    To delete:
    Key operation
    a character
    position the cursor over the character, press "x"
    a word
    position the cursor over the character, press "w"
    a line
    position the cursor anywhere on the line, press "dd"
    from the current position to the end of the current line
    press "D"
    block of lines
    :<range>d<enter>
  • Copying and pasting can be done by using the mouse.
  • Replacing text:
  • To replace:
    Key operation
    a character
    position the cursor over the character, press "r", then type the replacement
    a word
    position the cursor at the start of the word, press "cw", type the replacement, then press "ESC" key 
    a line
    position the cursor anywhere on the line, press "cc", then type the replacement, then press "ESC" key
  • Searching:
  • /string/<enter> to search forward from the current position for the string;
  • ?string?<enter> to search backward from the current position for the string.
  • For example, :1<enter> to move to the first line, then /sunyu/<enter> to search for the string "sunyu".
  • Searching and replacing:
  • :<range>s/string_old/string_new/<enter> to replace the first occurrence of string_old of each line with string_new;
  • :<range>s/string_old/string_new/g<enter> to replace every occurrence of string_old on each line with string_new (global replace).
  • For example, :1,$s/sunyu/sunyu_new/g<enter> to replace all sunyu with sunyu_new.
  • Saving and loading files:
  • save file as <filename> :w <filename><enter>
    save file with current name :w<enter>
    save certain lines to another file filename :<range> w <filename><enter>
    read in contents of another file at current position  :r <filename><enter>
  • Quitting Vi:
  • :q<enter> - quit Vi if the file is saved;
  • :q!<enter> - quit Vi and discard the unsaved data;
  • :!<command><enter> - enable users to execute shell commands without exitting Vi, after execute the command, return to Vi.


  • More editors

    Printing

    Internet

    X11 Window System

    Programming and compiling

    Applications

    Compressing and un-compressing
    1. "gzip filename" - compress files

    2. The original file is replaced with the compressed file filename.gz
      "gunzip filename.gz" - uncompress files
    3. "tar cvf filename.tar directoryname" - creates the file filename.tar containing all the files in directoryname.

    4. "tar xvf filename.tar" - extract the content of filename.tar
      In many cases, a tar-file will also be compressed, both to reduce network transfer time and to save space on the disk. Use "compress filename.tar" - the filename.tar is replaced with a smaller file filename.tar.Z .
      To retrieve the original file, use
      "uncompress filename.tar.Z"