Last updated: July 20, 2010
8. Terminal
Almost anything can be done graphically on a modern GNU/Linux distribution like openSUSE, but to really become a self-reliant user and to truly take advantage of the power of your GNU/Linux operating system, you should at least know a few terminal basics.
You'll find
Konsole under Favorites in the Kickoff menu.
Using the command line is quite easy. Simply enter a command and possibly one or more options and one or more arguments and then press Enter. Example:
ls -l /home/user/download/
The
command 'ls' displays a list of files, the
option '-l' means that the list will be displayed in a long listing format, and the
argument '/home/user/download/' sets the directory of which the contents are listed.
8.1 Useful Shortcuts
Tab-key
The tab-key is increcibly useful, if possible it will auto-complete commands and arguments, which helps you work faster and avoid typos.
Ctrl+Shift+V
Paste from the clipboard.
Ctrl+C
This shortcut stops any operation you may have started.
8.2 Examples of Basic Commands
This is just a very small selection of commands to give you an idea of how things work.
 |
| Commands written in red need to be ran as root. |
8.2.1 File Management
Changing directory
cd /home/user/directoryname/
Listing files of a directory
ls
Copying a file
cp filename /home/user/directoryname/filename
Deleting a file
rm filename
Deleting a directory including contents
rm -rf /home/user/directoryname
Moving or renaming a file
mv /home/user/filename /home/user/newfilename
8.2.2 System Monitoring
Find out your IP-address
ip a
Running processes and consumpition of system resources. Press
'Q' to exit.
top
Disk space usage
df
Memory consumption
free
8.2.3 Man Pages
Almost all commands have an accompanying manual page describing how to use the command and the available options. For example type:
man cp
To leave the man page again press
'Q'
8.2.4 Becoming Root
To switch to the root user to perform system administration tasks, type:
su -
Then type your (root) password. Nothing will appear on screen as you type, this is intended.
 |
| Do not work as root unless it's required. |
To stop working as root and return to working as your normal user, run
'exit'.
exit
8.2.5 System Tasks
Shutting down.
halt
Rebooting.
reboot
Start, stop, restart or get status of system services (start|stop|restart|status). Examples:
rcnetwork restart
rcSuSEfirewall2 stop
rcapache2 start
rcsmb status
8.2.6 The Kernel
Check kernel messages.
dmesg
Listing loaded kernel modules.
lsmod
Loading a kernel module.
modprobe [modulename]
Unloading a kernel module.
rmmod [modulename]
8.3 Editing Text Files
Editing configuration files or other text files can be done like this using the vim editor.
Open a file with
'vim /path/to/file'. Example:
vim /boot/grub/menu.lst
 |
| Root permissions are used in the example because menu.lst is a system configuration file - this is not generally required to edit files with vim. |
Press
'i' to enter insert mode. Now you can edit the file. When you're done editing press
Esc to leave insert mode. Now type
:x which is the command for exit and save.
8.4 Further reading
If you want to learn more about using the terminal there are many resources available on the internet, here are a couple of links.
http://www.oreillynet.com/linux/cmd/
http://www.tuxfiles.org/linuxhelp/cli.html
http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/index.html
Send your comments via e-mail to admin [at] opensuse-guide.org