Some Basic Commands
There are some basic commands that are useful when one is new to the Linux realm. Some of these commands will be covered in greater detail as we move through this journey. We discuss some of the basics here.
|Command Name||Command Description||Examples|
|~ (tilde)||This symbol stands for your home directory.||If you are pbmac, then the tilde (~) stands for /home/pbmac|
|pwd||The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory").||In some instances "pwd" in the Desktop directory will show "~/Desktop". The GNOME Terminal also displays this information in the title bar at the top of its window.|
|ls||The ls command will show you ('list') the files in your current directory. Used with certain options, you can see sizes of files, when files were made, and permissions of files.||"ls ~" will show you the files that are in your home directory. "ls /var/log" will show you the files in the /var/log directory|
|cd||The cd command will allow you to change directories. When you open a terminal you will be in your home directory. To move around the file system you will use cd.||
|cp||The cp command will make a copy of a file.||"cp bar foo" will make an exact copy of "bar" and name it "foo", but the file "bar" will still be there. If you are copying a directory, you must use "cp -r directory foo" (copy recursively). ("recursively" means to copy the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, "recursively")|
|mv||The mv command will move a file to a different location or will rename a file - the original file will be removed.||"mv bar foo" will rename the file "bar" to "foo." "mv foo ~/Desktop" will move the file "foo" to your Desktop directory, but it will not rename it. You must specify a new file name to rename a file.|
|rm||Use this command to remove or delete a file in your directory.||"rm foo" will delete the file "foo"|
|rmdir||The rmdir command will delete empty directories.||To delete a directory and all of its contents recursively, "rm -r directoryname"|
|mkdir||The mkdir command will allow you to create directories.||"mkdir music" will create a directory called "music" in the current directory.|
This is by no means an exhaustive list of basic commands, but this will get you started so you can begin to navigate around the system a bit.