Sunday 21 October 2007

11 most useful console tools

Here are the most essential command line tools:

> filename
Redirect output of commands into a text file, so that you can attach it to emails.
$ uname -a > mypc.log
man command
This gives a brief online description of the command. man always requires a parameter.
$ man uname
sudo command
Run a command with full access rights. You will be asked to enter your password again. The command then executes.
$ sudo chown root:root /etc/init.d/networking
Attention: You turn off Ubuntu's protection features, so double check what you enter!

uname
Provides general system information. Usually called like:
$ uname -a
less filename
If you need to view configuration- or logfiles, less allows you to view them on the console. less always requires a parameter.
$ less /etc/X11/xorg.conf
tail (-f) filename
To view just the most recent part of logfiles, tail shows the last 10 lines of the file. The parameter -f will show new lines as they come in.
$ tail -f /var/log/syslog
lspci
Lists all devices attached to the PCI bus. You can analyze hardware problems with this.
$ lspci
lsusb
If you have trouble with USB devices, this lists all attached USB ports.
$ lsusb
lsmod
Lists kernel modules and their dependencies. You may want to find out, if kernel modules are loaded at all and which modules depend on others.
$ lsmod
dmesg
To read what was printed on the boot screen, this command preserves the messages even when you are in X-Windows.
$ dmesg
sysctl kernel.parameter
If you ever need to display or set any kernel parameter, you can use this.
$ sysctl kernel.hostname
To start a console window, from the main menu select Applications -> Accessories -> Terminal. At the prompt ($) you can enter your command. The output will be shown in the same window.

No comments: