Awesome Ubuntu Commands You Need to Know!

Article by Josef Nankivell (4,324 pts ) , published Jul 14, 2009

Just switched from Windows and still a bit scared about the command line? You shouldn't be! The command line is a very powerful, fast and intuitive tool to get things done without clicking buttons and navigating through menus.

Begin!

Master the command line starting with this. In the man intro to the Terminal the following is stated:

"Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and hopefully get work done without first reading lots of documentation. The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are."

So let's listen to the manual, start the mighty Terminal and learn some cool commands:

Main Menu > Applications > Accessories > Terminal

Install Apps like a Pro

Usage:

sudo apt-get install application-of-your-choice

What it is: The Advanced Packaging Tool (APT) is a easy to use user interface that handles installing and removing packages (aka applications).

Explanation:

Let's say you want to install "widgets" similar to those on Windows Vista and Mac OS X. You can just type:

sudo apt-get install screenlets

and you're done! In less than 5 seconds!

The alternative would be to navigate to the "apt-get" graphical front-end called "Synaptic Package Manager", wait until the packages database refreshes, click the search button, wait for the response, select the package, click Apply, wait for the installation to complete, the database to refresh and finally exit. Wasn't the command line much easier and faster?

Tip

When a binary package isn't available, you download the source code of the application and install it using these commands:

tar xvf MyCuteApp.tar -extracts the the application from the archive.

cd MyCuteApp -navigates to the extracted folder.

./configure -configures the app you want to install.

make -compiles the app.

su -allows system wide changes.

make install -Installs the application.

Fun with folders

Usage:

pwd shows current folder

cd /home/user/MyFolder/ navigating to a folder

ls /home list of what's in a folder

mkdir NewFolder create a new folder

copy cp Folder /user/home -r

Move mv /user/home/Folder /media/USBStick/

Remove rm /user/home/Folder -r

Cool Commands

Here are a few great commands for you to try out when you have nothing else to do!

Show the current date and time date

Show this month's calendar cal

How much time did I spend at the computer uptime

Who are you? whoami

Brag about how much free RAM you have on Linux free

Where is that application I just installed whereis [app]

Disk space usage df -h

Shutdown

Congratulations! Since you're now a linux hacker, you live and breathe in the Terminal. So why not shutdown from the terminal?

To shutdown:

sudo shutdown [-h] now

or restart:

sudo shutdown [-r] now

Look it up!

Unsure what a command does? Read the the short manual and find out.

man command

AncientPC from Digg recommends [-k] apropos option: "Sometimes I wanted to do something but didn't know the correct command to man page, which is where apropos comes in."

Comments

Oct 18, 2009 12:11 PM
Pezed
format hard drive
Hi. is there a command that I can input to my laptop during the boot up that will erase my hard drive? I wish to erase jaunty jackalope and revert back to intrepid ibex, which I have on dvd.
Jul 18, 2009 8:51 PM
Notes and Minor Corrections not previously covered
Move: mv /user/home/Folder /media/USBStick/
More accurately /home/user/Folder
However, as this is meant to be convenient to the new user, I would probably have mentioned either tilde (~) for automatic home folder selection or open period ( . ) (not to be mistaken for a bummoticon) for the current directory, often negating pwd for a "You are Here >" sign.

man and man-references are confusing to new users, and I have no clue why you even put them in the shutdown options. These would be easier to follow if you simply used them without the brackets, as documenting these would actually appear as:
shutdown [h|r] now
followed by the explanation of using hyphens (-) and the concept of mutually exclusive options, if not also the less obvious source of h being halt.

Similarly, mentioning apropos without usage context can be equally confusing

One related advantage that I've noticed while using Ubuntu, so I don't know if it's Ubuntu only or a change in practice, the man pages have been simplified, by in large part, removing the typical [abiocli|sm|lh:integer|n:integer] style documentation (yet still leaving square brackets to identify the word "options" as non-denotative/explicit).

man and apropos users are likely to come across the clearly linked and organised info pages (instead of the cryptic 1-6 folders of man pages that, in my opinion, the actual standard seems ignored by the occasional application).

Finally, nothing here is unique to ubuntu, and you use both su and sudo, where, if I recall correctly, only sudo is installed by default -- if I recall correctly, I had to install su for my scripts from previously using Debian Sid. This is more along the lines of a, "getting comfortable with the commandline," without focusing as much on the regular use needs.
Jul 2, 2009 11:09 PM
Robert Miles
Simple data base
I am familiar with Unix (SCO) 15 year old version.

Can you please point me in the right direction to get a suitable simple phone/address book.
I'm using a 15 year old 256k Casio which will not last much longer. It does everything I need i.e. one can store about 520 characters under any heading and have about 250 of these in free format. The only indexed field is the first name i.e car1, car 2, etc or solicitor or a single persons name.
The best feature is that it runs on dry cells which last about 6 months.
I have just got an ASUS EEE PC 701SD series which although it is twice the size and weight will do the job and runs under Linux

Many thanks for any help you can give me.
Kindest Regards
Robert Miles
Jun 20, 2009 1:21 PM
UbubtuLinuxHelp
uptime
The command uptime does not show how how much time you spent at the computer. instead it show how long the computer has been running since boot and the process load averages active during the past one, five and fifteen minutes.