2011-07-05

Top Five Terminal Commands Everyone Should Know (as suggested by you)


Reader Raiyan mailed in with an idea for an article a few weeks back, titled ’Top five commands a new-comer to Linux should know.’

A great idea, but we all have different ideas about what makes a must-know command. So I took to thelick="javascript:_gaq.push(['_trackEvent','outbound-article','twitter.com']);" target="_blank"> @omgubuntu twitter account to ask you – the readers – what five commands would be in your top five.

There were literally hundreds of responses, so thanks folks! Below are the five most suggested commands by OMG! Ubuntu! twitter followers.

One | ‘sudo’


‘Sudo’, best thought of as ‘Superuser Do’, allows you to run commands with elevated permissions, typically those of the ‘root’ user.

If you have ever tried to run a command or install an application using the command line only to be told you ‘need to be root’ chances are you need to prefix your command with ‘sudo’.

sudo is always placed at the beginning of a command. For example, running the following command will update the System package lists:
  • sudo apt-get update

To run graphical applications as root – e.g. root Nautilus, root gedit to edit a system file – ‘gksudo‘ is best advised for use in place of ‘sudo’.

Why? Firstly it’s the ‘proper’ way, and secondly it avoids any potential ‘hiccups’ that can often occur when using ‘sudo’ to run graphical applications.

With this in mind you would run Nautilus file manager like so: -
  • gksudo nautilus

Two | cd


‘cd’ (Change Directory) is the command used for navigating folders in the Terminal.



By default the Terminal opens ‘in’ your Home folder.
  • ‘cd folder/name/’ will navigate you into that folder
  • To go back on folder type ‘cd -
  • Typing ‘cd‘ on its own returns you to the ‘Home’ folder

Tip: Remember you can always use the ‘Tab’ button to auto-complete commands and locations in the Terminal. To quickly get to the Desktop using the cd command one could just type
  • cd De

then hit the Tab key to complete the command to
  • cd Desktop/

Three | ls


Navigating into folders is all fine and dandy – but how can you tell if the file you want is in there?

That’s where the list command – ‘ls’ – comes in.
  • ‘ls’ lists all of the items (bar hidden files) in the current folder
  • ‘ls -al’ lists all items in a folder, including hidden files and directories

Four | sudo apt-get install


Applications available in the Ubuntu Software Center and added PPAs can be installed from the command line using ‘apt-get install‘.



For example, to install the Chromium web browser in Ubuntu you would enter: -
  • sudo apt-get install chromium-browser

apt-get can also be used to remove packages. To remove the Chromium web browser you would run: -
  • sudo apt-get remove chromium-browser

Five | uname -a


“How Can I tell What Kernel Version I’m Running In Ubuntu?”

Simply by opening a Terminal then entering:
  • uname -a



If you have an idea about something we should cover, send us a shout via the Tip Form.



Source

No comments: