Saturday, May 30, 2009

Become a Command Line Commando

The command-line interface (CLI) is a tool for interacting with the operating system or software by typing commands to perform specific tasks.

In Ubuntu the default command line interface is the gnome-terminal. You can find it under Application>Accessories>Terminal.

For some tasks, especially things like system configuration, it makes sense to use the terminal. This guide will show you how to use the command line to keep your system up and running, how a fix common errors and edit some things.

- The majority of these commands require you to be the superuser. To execute these commands as the superuser you will use sudo at the beginning of each command.

apt-get is the command-line APT package handling utility. It works with core libraries to handle the installation and removal of software in Ubuntu. The following are the most common APT for managing your software and system.

Install a package
sudo apt-get install [name of package]

Remove a package
sudo apt-get remove [name of package]

Remove a package and its configuration files
sudo apt-get purge [name of package]

Update your system
sudo apt-get update

Install updates
sudo apt-get upgrade

Does the same as clean but it only removes package files that can no longer be downloaded, and are largely useless (my preferred method)
sudo apt-get autoclean

Used to remove packages that were automatically installed to satisfy dependencies and that are no more needed (another favorite)
sudo apt-get autoremove

Frees up space by clearing out the local repository of retrieved package files
sudo apt-get clean

If you want to learn more apt-get commands read user manual
man apt-get

dpkg is the software at the base of the Debian package management system. It is used to install, remove, and provide information about .deb packages. These are some of the most common dpkg commands for fixing problems with .deb packages and broken systems.

When something goes wrong with an upgrade, use this command and all unpacked but unconfigured packages we be configured.
sudo dpkg --configure -a

To fix a specific .deb package
sudo dpkg-reconfigure [name of package]

To fix your xorg.conf file, for resolution or graphical problems.
- In most cases, selecting the default options will fix the majority of your issues on the Dell Mini 9.
sudo dpkg-reconfigure xserver-xorg

If you want to learn more dpkg commands, read the user manual.
man dpkg

Some other helpful terminal commands:

To terminate the process currently running in the terminal by sending it a SIGINT command.
Ctrl+C [press the Ctrl and C keys simultaneously]

Edit you source list.
sudo gedit /etc/apt/sources.list

Edit your file system table (fstab).
sudo gedit /etc/fstab

Edit your xorg.conf.
sudo gedit /etc/X11/xorg.conf

Add kernel modules to load at boot time
sudo gedit /etc/modules

List all drives.
sudo fdisk -l

Mount a drive.
sudo mount [/path/to/drive]
- to learn more on how to mount drives, read the mount user manual
man mount

To unmount a drive.
sudo umount [/path/to/drive]- to learn more on how to mount drives, read the mount user manual
man umount

Configure, control, and query TCP/IP network interface parameters.
- to learn more commands for using ifconfig, read the usual manual.
man ifconifg

Configure, control and display the parameters of wireless network interfaces.
- to learn more commands for using iwconfig, read the usual manual.
man iwconifg

If you have a favorite command, feel free to leave them in the comments, I'll add the best ones to the guide.

Have a question or problem that this article doesn't cover?
Ask our Ubuntu Mini 9 Google Group for help.


Anonymous said...

top - text based process manager

kill - terminate a program that has stopped responding

Anonymous said...

free -m

Craig552uk said...

Shouldn't Mount be
sudo mount [/path/to/drive] [/path/to/mountpoint]

Lists freespace on partitions
df -h

Count number of lines
wc -l

e.g. df -h | wc -l

And of course grep!

jp said...

( top + kill + others ) = htop
try htop : you will forget top ...