An Introduction to Linux Command Line Part-1
There are two types of user interfaces Graphical User Interfaces (GUI) and command line interface (CLI). In GUI you use mouse to give instructions, in command line you type commands to control your computer. Linux provides two ways of exploring command line, you can either start a terminal emulator or switch to virtual console.
Terminal Emulator
Terminal emulator is a program that provides access to command line when you are in GUI. It opens up a window in which you can type commands. To start a Terminal Emulator look in the application menu.
Virtual Consoles
To switch to virtual console press <Ctrl><Alt><F1> i.e. press and hold control key then press and hold Alt, now press F1 key. It will give you a log in prompt where you can type in your username and press enter. Now type your password to login. While typing the password you won’t see it on screen. You can type commands after logging in. There are six virtual consoles by default. To switch to second one press <Ctrl><Alt><F2> and so on. To switch back to GUI press <Ctrl><Alt><F7> .
Noramal users and root user
When you open up a terminal or login into virtual console it will show you something like
[username@hostname~]$ eg. My laptop shows [sumit@sumit-laptop ~]$.
The $ sign means that you are normal user, you only have limited powers. A root user has many more powers than a normal user, as a root user you change all the critical system settings. There are some commands that only a root user can run. To become a root user press enter after typing
su – [if you are using Slackware, Fedora or Red Hat based distribution.]
sudo -i [ if you are using Debian, Ubuntu].
It will ask for your root password please enter it and also it is important to note that while you
are typing the password it will not be displayed on the screen for security reasons press enter after your are done typing the password. For Ubuntu this password is same as your user password, Fedora and others asks you to set root password during installation.
After you become a root the prompt will look something like [root@hostnamename~]#.
Now you are root user. Since a root user can make critical changes and even delete important system files so be careful with what you type as a root user. Only login as root user when necessary.
Basic Linux Commands
In Linux the general syntax of any command is
command name [options] [arguments]
Options usually start with “–”
Example : In command ls -l /home, -l is option and /home is argument.
The things that are written in [] brackets means that they are optional i.e. you may or may not use them its your choice but you may use them to modify the behavior of command according to your needs. If you don’t use them some defaults options and/or arguments will be used.
1. pwd (print working directory)
To find out where you are in file system tree i.e. current directory type
[user@host~]$ pwd
/home/sumit
So by looking at the output we can say in am currently in /home/sumit directory.
2. ls – list directory contents
Now you know that you are currently in /home/sumit. Now you can type ls to list all the files and directories in /home/sumit directory.
ls command also acceps arguments and options like most of linux commands. Using ls with option -l i.e. Typing ls -l will give you more detailed output. If you type ls /home, the command will display all the files in /home folder. Here /home is taken as argument.
3. cd – change directory
You can you use cd to change you current directory (pwd). While using cd you can either specify relative path or absolute path. Relative path depends on your current directory (output of pwd command) i.e. their result depend upon your current location in file system tree, absolute paths always start from / and their result does not depend on your current directory. Ex – Let us say your current directory is /home/sumit and /home/sumit contains a folder named Documents. I can type “cd Documents” to go to Documents directory (relative path) or I can type /home/sumit/Documents. The former only works when my current directory is /home/sumit. If you type cd .. it will take you to the parent directory i.e. if you are in /home/sumit/ typing cd.. will take you to /home, now typing cd .. once more will take you one step higher to / directory.
4. mkdir – make directories
You can use mkdir command to create new directories, here you can use absolute or relative paths just like cd command.
[user@hostname ~]$ mkdir dirname (create a directory named mkdir in current directory)
[user@hostname ~]$ mkdir /home/sumit/test2 (creates directory /home/sumit/test2 using absolute path).
5.Using Tab auto completion
Use can use auto completion to save time when typing commands or filenames. If you are typing mkdir command, just type mkd and press tab it will auto complete the command, if it doesn’t press tab twice and it will list all the commands that has mkd as its first three characters. Simiraly you can type
ls /ho and press tab is will auto complete the command to ls /home.
6.Using History
All the commands you type and stored in history. You can move b/w history by using upper and downward arrow keys on your keyboard, and press enter to execute.
Although u can also type Command-”history” and you will see that the commands you types in the past with a number. Want to run the command directly without typing again type “!number” and the command on that number will get executed. Here’s the screenshot
Well thats it for now… Wanna know More abt the CLI Basics… Wait For Part-2








Well it started off like it could teach me something but it soon got wrapped up in computer language gobbledygook and my will to live started to seep out the back of my head. This is an introduction to Linux language for people who are already computer pros or geeks. As just a “User” I don’t have the time or inclination to get so involved. Just once I would like to find a Linux tutorial that will tell me where to put the oil and how to check the level without insisting I become a mechanic before I can take the wheel.
Nobody said this was an introduction to Linux – It is an introduction to Linux Command Line (and a pretty good one too I might add). If you need an introduction to Linux, tam, google it!
I am sorry do you know how to google it, or do you need an introduction for that as well. Linux is definitely not for people with your IQ.
Go into the terminal and use some of these commands (ignore sudo and su for now though and work just in you home directory) and it will become fairly obvious of what’s going on with it. It’s a lot harder to tell someone how to check the oil than to just show them. Show yourself by opening up a terminal and copying some of these commands. There’s absolutely nothing dangerous about the commands given. And as a user you will find sometimes a command line tool really is easier than anything else availible. Plus once you get most linux distros setup there isn’t a whole lot of maintainance needed. Just make sure your root filesystem isn’t full, apply updates regularly which are generally small and don’t break things, and setup a firewall if you computer isn’t already behind one. There is no patch tuesday, anti-malware, anti-virus and defraging like some inferior OS’s/
Sorry guys, I was just exasperated when I wrote the above.
“Terminal” I’ve figured out, that’s where you type in the gobbledygook to get things to work. I can’t see how that could ever be easier than clicking a few buttons. I don’t have to learn computer speak to click buttons.
Sudo and su….Home Directory….Root filesystem
Woooosh………what was that going over my head?
Good Post. Thank you
I like this site very much so much good info .
Real clean web site , appreciate it for this post.
I like this post, enjoyed this one regards for putting up.
Lovely just what I was looking for.Thanks to the author for taking his clock time on this one.
superb post.Never knew this, thankyou for letting me know.
I am impressed with this site, really I am a fan .
I the efforts you have put in this, thankyou for all the great content .
Merely wanna admit that this is very beneficial , Thanks for taking your time to write this.
Really nice layout and excellent written content , very little else we need : D.