Friday Fun – Useful Linux Terminal Commands for New Users. 03/07/08

Below are the most useful commands (or at least those I found most helpful) when I switched to Ubuntu, to clarify, these commands are not Ubuntu specific, they are Debian Linux commands. I’ve not included some of the basic commands like cd, rm, mv, ls, etc… Play with your terminal, that’s a great way to spend a Friday afternoon! Hee hee hee… (Yes, I’m a geek!) ;) These commands are in no particular order, I just find they are the more helpful (for me and a few of the “converts” near me).

Execute each command as root, which is safer than actually switching into root via “su”.

Displays the network card connection/configuration.

sudo apt-get install PackageName
Will install the whatever “PackageName” I typed and the dependancy files.

sudo shutdown -h now
Shuts down my Ubuntu and powers it off right away.

Command to complete more that one action. For example:
sudo make && make install
Which runs the “make” script and then installs the “made” package.

Sends test packets to whatever IP you type in, to help troubleshoot network connections.

apt-get moo
Just to look smart! ;) Try it!

cat /etc/issue
Displays the current Ubuntu version.

Will download the file from any URL you enter after “wget”

tar -zxfv madwifi-cvs-20051025.tar.gz
Will uncompress the downloaded file

z means “Gunzip(uncompress) it before extracting, used on file ending in .tar.gz or .tgz”
x means “Extract the contents of the TAR file”
f means “Filename to follow”
v means “Verbose – display contents as it is tarring or extracting”

chmod +x
Command that says “Make the script file executable”. I sometimes run into this after using wget and trying to run installer scripts.

sudo apt-get autoclean
Removes partial packages.

sudo cp /home/roger/backups/bk03072008.tar.gz /var/www/downloads
Copies a file from one directory to another directory. (in this case the file bk03072008.tar.gz was copied to the /var/www/downloads directory).
If you don’t want to copy but move the file, change cp to mv.

find . -name “*.odt”
When looking for OpenOffice documents (in the current directory and all it’s subdirectories) or find ./roger -name network_notes.odt when I know the exact name of the file.

Move up one level in the directory structure.

iwlist scan
Dislay wireless networks that are in range.

mkisofs -V LABEL -r dir | gzip > backups.iso.gz
Makes a CD image of the backup directory contents

cdrecord -v dev=/dev/cdrom blank=fast
Quick command to erase a CDRW

history -c
In a multiuser environment, it is sometimes not good to leave history. Of course you can just “exit” to leave the terminal.

Displays the processor architecture so I know if I should download i386, i686 based application pakages.

whereis something
Displays where “something” is stored.

There are 100′s more. But these are the ones I tend to use more often. As usual, I hope this helps others! :)

And… one for the road…

If you want to create a file called “me”, just “touch me:)

[tags]linux, ubuntu, terminal, commands[/tags]

Care to Share?

You can leave a response, or trackback from your own site.

31 Responses to this article

Mackenzie March 8, 2008 Reply

“sudo shutdown -h now” can be shortened to simply “sudo halt” Also, I think you need a “cd” before that “..”

The z for .tar.gz’s and j for .tar.bz2′s are no longer necessary. Tar just kinda figures it out and does it automatically. “tar xf ….” works just fine on both.

&& isn’t exactly what you think it is either. To just list commands, use ; What && does is says “IF the command on the left completes successfully, THEN do the command on the right.” You can use || to say “IF the command on the left fails, THEN do the command on the right”

Mackenzie March 8, 2008 Reply

Oh, another way to get the distro version, which I’m pretty sure works cross-distro (/etc/issue isn’t on Fedora systems, I don’t think), is “lsb_release -a”

UbuntuLinuxHelp March 8, 2008 Reply

@Mackenzie – Thanks for the input! If make fails for some reason we would not want to && make install ;)

Al Biheiri April 27, 2008 Reply

to shutdown I use init 0…works on bsd & solaris too

Ray April 27, 2008 Reply

also all the apt-get commands are only good on Debian based systems(which Ubuntu is). Fedora, Mandrivia or Suse will not be able to do anything apt related without customizing.

UbuntuLinuxHelp April 28, 2008 Reply

@Ray – Yes that’s right. Remember, this is an Ubuntu based blog. And, Ubuntu is based on Debian… Hence the URL:;) :)

Michael April 28, 2008 Reply

Very useful list, but…

>> these commands are not Ubuntu specific, they are Linux commands.

…apt commands are Debian specific.

UbuntuLinuxHelp April 28, 2008 Reply

@Michael – Yes you are right. I added the word ‘Debian’, to clarify the post. ;)
Also, I read with interest your blog post “DAS Festplattenproblem unter Ubuntu”. Is this still a problem, also in, Ubuntu 8.04? The fix (to edit the “/ etc / acpi /”) was well laid out too. :)

isecore April 28, 2008 Reply

sudo is NOT safer than becoming root through su. It’s just more convenient, since you don’t need to know the root-password. Some distributions such as Ubuntu doesn’t even have the root-account enabled.

In fact, a lot of these things are either slightly incorrect or just plain incorrect.

UbuntuLinuxHelp April 28, 2008 Reply

@isecore – “sudo is not safer…”? It sure is safer, in my opinion! It prevents me from accidentally doing something wrong. If I leave myself in sudo su, I can accidentally do something wrong much quicker than I’d do by typing sudo. With sudo su anything can be done. There are some things you don’t necessarily want to do in root.

In other words sudo su gives me privileges on the entire server! (As it switches the user environment and privileges to root).

Whereas sudo allows me to run commands after being prompted for my normal user password, and if the root user has given me permission (in the sudoers file) to perform that action, then I will be able to do it.

If you found a command that is incorrect, it would be helpful to clarify.
Or you could just show shorter versions or explanations like ‘Mackenzie’ (above) did on one; which helps everyone. :)

Keep in mind that these commands work perfectly on my Ubuntu Linux 7.10 and 7.04 boxes. :)

Someone April 28, 2008 Reply

Sudo when set up with correct permissions is in fact safer. The default *buntu install is generally not set up this way, sure there is no root password, but if someone gets the first users password, 99% of the time that gives them as much access as root anyway. The idea of sudo is to give certain users or groups access to certain commands without the full root access that you get as a default setup in ubuntu. IMO this gives many users a false sense of security, thinking they are safe just because root is disabled and they use sudo.

steve April 30, 2008 Reply

When I use arch I get a command not found message.

Using gutsy

UbuntuLinuxHelp April 30, 2008 Reply

@steve – It works at this end. I get ‘i686′…
It seems not everyone has it working if you check the Ubuntu forum here: ;)

guitarman_usa April 30, 2008 Reply

Also a note on using && Remember it stands for the logical operator AND. So when you say:

sudo make && make install

make install will ONLY run if ‘sudo make’ executes properly (which is what you would want in this case)

you can also use || (logical OR) to complete the second task only if the first task fails

cd dirA || mkdir dirA

if dirA doesn’t exist, make it
the logical operators can be combined too

cd dirA || mkdir dirA && cd dirA
if dirA doesn’t exist make it, and if successfully made, change into it

to combine tasks, use a semi-colon. I.E.

mkdir dirA; cd dirA; wget http://...

(will make a new directory dirA, change into that directory and then download whatever is at http://... into the current directory, dirA)

cd dirA || mkdirA && cd dirA; mkdir dirB
this one is for you to figure out

UbuntuLinuxHelp May 1, 2008 Reply

@guitarman_usa: Ah ha! :)

cd dirA || mkdirA && cd dirA; mkdir dirB


Change to dirA OR make dirA (if we’re unable to change it) AND (if dirA is successfully made), change to dirA then make dirB (because of the combined task). dirB will be made inside dirA.

I get it! Cool! :)

Thanks for the input. Simple as it is, this is very good to add to backup scripts (as well as a couple other things).

Thanks :)

Ghost|BOFH May 17, 2008 Reply

Just a quick note: They are trying to ween people off “apt-get” and instead suggest using “aptitude” as it is generally considered more complete and better at picking up dependencies…or something like that.

UbuntuLinuxHelp May 22, 2008 Reply

@Ghost|BOFH – Thanks for the input. :)
Question: Didn’t I read something via Digg a while back that pointed to a big post about the evils of Aptitude, and how they were recommending it not be installed? Or am I just mixing that up with something else?
Thanks… :)

RZ September 20, 2008 Reply

to reboot you have a few ways.
“sudo init 6″ or “sudo reboot”
if you are at a true terminal (not in X) just hit ctrl+alt+del

to halt, “sudo halt” is sufficient
or you can do “sudo init 0″
The init commands call their respective runtimes.
0 = halt, 6 = reboot, and i think 5 is gui (per most preconfigured distros, can be changed on a “from scratch” system)
I know you all prolly know this, and correct where wrong, but just putting it out there for the beginners.

Travis October 1, 2008 Reply

Look, the title of this post is “Useful Linux Terminal Commands for New Users” how is using init or even halt more intuitive to the new user than shutdown and reboot respectively? Also, I wonder why the author assumes that all new users would be using the apt package manager (not every new user jumps to ubuntu). Also, a couple of no brainers for a new user would be man, whatis, and locate. Anyway, I’m done ranting. Glad to see the effort out there to help new folks but I think some of us go a little over the top in what we think is something a newbie should know. The learning curve is fairly steep ( though thankfully now not nearly as steep as it used to be) and it’s all about the baby steps :) . Cheers

Travis October 1, 2008 Reply

**edit above post**heh woops jumped the gun. i got here via stumble and didn’t realize this was an ubuntu site. heh apologies to the author for jumping the gun on the apt comment.

UbuntuLinuxHelp October 1, 2008 Reply

@Travis – No worries. :)
Cheers! Thanks for the extra input and perspective.

UbuntuLinuxHelp October 1, 2008

Also, with Ubuntu 8.04 I understand the command should be “aptitude” in place of “apt-get”. I understand that aptitude removes unused dependencies when uninstalling an application, whereas apt-get does not. I did a quick google to confirm this and found a great blog post about the differences here:

KSiimson December 23, 2008 Reply

To previous commenters: I’ve been told that apt-get and aptitute have the same functionality since Ubuntu ~6.04.

Joshua Welch February 16, 2009 Reply

You should put “ctrl C” will stop the ping, cause windoze users are used to standard 4.

Nihal singh March 23, 2009 Reply

useradd (name)

for add the new user

passwd (name).user nam and enter

than hit the passwd

Nihal singh March 23, 2009 Reply

future in linux is best os

blue June 2, 2009 Reply

@ Mackenzie “$cat /etc/issue” works on Fedora

billg June 10, 2009 Reply

Sudo this, Linux.

Microsoft OS rules!

UbuntuLinuxHelp June 10, 2009 Reply



hyunjungsoh March 25, 2011 Reply

Regarding this line…


Where will the file be saved right after it got downloaded?

UbuntuLinuxHelp March 27, 2011 Reply


It will be saved to the directory you are in (when using the wget command). For most of us that would be our home directory / username (unless we cd into another directory).

If my username is “joe”, then the file would be saved in: /home/joe

Leave a Reply

close comment popup

Leave A Reply