Appendix B. Basic Linux/UNIX Commands
The tables in this appendix list some basic Linux/UNIX commands to get you up and running. There may be slight differences in syntax from distribution to distribution, and there are many, many more commands. Check your user manuals, online resources, or simply type man command at the prompt for more information on any command, where you replace command with any Linux/UNIX command.
Table B.1. File System Navigation CommandsCommands | Descriptions |
---|
cd path/directory-name | Changes the directory to the specified directory. | ls | Shows a short version of the file listing of the current directory. | ls –l | Shows the file listing with more information. | pwd | Shows the name of the directory you are in. |
Table B.2. File Viewing CommandsCommands | Descriptions |
---|
cat file-name | Shows the content of the file you specify on screen. | less file-name | Opens the file to view in a read-only mode (Linux systems only). | pico file-name | Opens the file in a text editor. |
Table B.3. Directory and File Manipulation CommandsCommands | Descriptions |
---|
cp –r source-dir dest-dir | Copies a whole directory's contents to dest-dir. | cp source-file dest-file | Copies a file named source-file to a file named dest-file. | mkdir dir-name | Makes a new directory with the name dir-name. | mv path/source-file path/dest-file | Moves a file from source-file to dest-file in the appropriate paths. | rm file-name* | Removes a one or more files matching the wildcard statement using * (asterisk). | rmdir dir-name | Removes a directory. Will not remove non-empty directories. | rmdir –rf dir-name | Removes the directory and all subdirectories and files under it. |
Table B.4. Miscellaneous CommandsCommands | Descriptions |
---|
date | Shows system time and date. It is important to make sure this is the correct time and date. | df | Checks file system's capacity. | du | Shows disk usage. | grep string | Searches for a string when used with other commands. For example, ls | grep Tony will list all files with Tony in their name in the directory you issue the command in. | printenv | Shows all the environment variables for the current user (terminal, shell, text editor preferences, and so on). | ps | Shows running processes owned by current user. | ps –ax | Shows all running process. | w | Shows logged in users. |
|