The terminal can be really fun to use once you get the hang of it. Without writing a entire tutorial for the terminal commands in this post, I’ll try to post some of the basic commands and tips for the terminal. One of the cool things about the terminal is that virtually everything can be run from the terminal, and this is a plus because some programs may give you output or error messages, as apposed to the graphical method which may not give you constantly updating information as you go along. So now that we got what the terminal is used for, here are some basic commands to use when in the terminal, or Konsole as it is called in KDE.
The cd command is the one that will allow you to move from one directory (folder) to another. This command needs to be followed by a location. For example, the following would allow you to be placed in the directory for your desktop (Note: replace name with your own username)…
cd /home/name/Desktop
Another tip is that you don’t have to repeatedly use the /home/name/ parameter over and over again: by using a tilde (~), you can replace the /home/name/ command. For example, the following would also place you into the Desktop directory in the terminal…
cd ~/Desktop
The next thing is that when using the cd command, you don’t have to put the full location of a directory if you are already in the parent folder. Simply, if you’re already in the /home/name directory, then you don’t have to add the /home/name parameter into the command. The example below would also place you in the Desktop directory if you are already in the /home/name directory (with name being your username)…
cd Desktop
The next command is the l -ls command (dir will give the same output, but without the number of files in a directory, which we will get to in the following) which outputs the contents of the current directory you are in, including the permissions for each directory or file and the name of the file to the far right. This is useful when trying to find which files are located in the current directory and for trying to find how much deeper you can surf into a directory.
NOTE: When entering a parent directory, or one that is not inside the directory you are currently in, you must dd the “/” (without quotes) before the location to indicate that you are entering a directory above or outside the current one.
To delete files or directories, use the rm command. This command also requires a location to follow it. Be sure that you want to delete the file, or that you are deleting the correct files: files or directories that are deleted using the rm command do not go into the trash folder, but are deleted permanently, so take care in using this command. You can also add the parameter -f to force a file to delete if it contains an error that restricts it from being deleted. Although this parameter can be useful, use it sparingly, because some errors may be shown because the file is required by another file, etc. Here are examples of the commands…
rm /the/location/of/the/file.rpm
Forced delete:
rm -f /the/location/of/the/file.rpm
The last and one of the most important commands is the su command. This command, standing for SuperUser, will allow you to have root permissions while using the terminal. This is very useful when a file requires a root privilege. When you enter this command into the terminal, you will be prompted for the root password. Once you enter the password, you will have unrestricted access to files and directories. When you enter the command into the terminal, it will look like the following…
name@linux-x0x0:~> su
Password:
linux-x0x0:/home/name #
The # indicates that you are a SuperUser.
There are countless other commands for the terminal, but these a just a few of the main ones you will use frequently.
If you need to see other commands, refer to the OpenSUSE Wiki: Terminal page.
There is also the the BASH Wiki Page which has some information on BASH, the shell the terminal uses.
Hope this helps! 