Once you’ve installed Linux, you can start doing your work right away. (To learn how to install Linux, read part 1 and part 2 of this getting started with Linux tutorial). Linux distributions available today are very much user-friendly and ship with necessary tools pre-installed.
One should still learn some basic commands to get the real taste of Linux. This is where Linux excels from other operating systems. You can perform almost every task from the command line for which you use some GUI tool. The plus point is the boost in speed you get. And, there some tasks that NEED to be performed on the command line- so one should know the basics.
Some basic Linux terminology:
Shell: A shell is a program that takes text input from the keyboard and gives it to the operating system. It acts as an interface between your fingers and the operating system.
Terminal: The terminal (precisely terminal emulator) is a program that lets you interact with the shell. This program comes pre-installed with almost every distribution (although it can have variants like gnome-terminal, konsole, terminology etc).
Kernel: Kernel, simply put, acts as an interface between the software and hardware. Linux is basically just the kernel. The complete operating system includes a kernel and a bunch of other software. As the term Linux is being used more commonly than the actual GNU Linux, I’ll be using that.
Some commands in Command Line:
Here’s a list of some most commonly used commands for performing some most common tasks. A good practice would be to have these commands on hand whenever you need. So, either take the printout of this page, or write them down somewhere.
- ls: This command displays the list of files and folders present in the current directory. Whenever you open up your terminal, it is in your home directory. Type “ls” and you should see the contents of your home directory. To verify, check your home folder in a file manager.
- cd: This command changes your working directory. Choose a folder name you saw in the previous command. Let’s say “Downloads”. Type “cd Downloads”, and you are in “Downloads”. You can also use the auto-complete feature. Like typing “cd Dow and press <tab>”, but that’s extra stuff. To verify, open up your file manager. Open “Downloads” folder. Right click and create an empty document. When you’ve cded into “Downloads”, type “ls” and you can see the document’s name there. Type “cd ..” to get to the previous directory.
- rm: This commands removes files or directories. First close your terminal (type “exit”) and re-open it. Type “cd Downloads” and then “ls”. Now type “rm <document’s name>”. You can see in your file manager the document you’ve just created is gone. Remember that rm deletes the file permanently. There is no recycle bin or trash. To remove directories, type “rm -r <directory name>”. Another helpful thing is “rm *”, it removes all the files present in the current directory. ‘*’ is a wildcard. Or type “rm *.jpg” which removes all the files with extension ‘.jpg’.
- cp: This commands copies files or directories from one directory to other. Create a folder in your home directory. Type “cp -r <folder name> Downloads/” and the folder would be copied to Downloads. The ‘-r'(recursive) option tells the ‘cp’ command that following is a directory and not a file, else, you’ll get an error.
- mv: This command moves the file or folder between directories. Create a new file in your home folder. Type in your terminal “mv <file name> Documents/”. The file has been moved to the Documents folder. You can check that by typing “cd Documents” and then “ls”.
- mkdir: This commands creates a new folder in your present working directory. Type “mkdir stuff” in your terminal. Type “ls” and you’ll see the “stuff” folder there.
- clear: This commands clears your terminal screen. Just type some random stuff in your terminal. And then type “clear”. The buffer would clear up.
Some more command line tools:
- cal: This command displays the calender on your terminal screen.
- nano: It is a command line text editor. Just type “nano <any random file name>” and it will open up a window. Here you can type some random stuff and press “ctrl-x” (Hold ctrl key and press x) to close the window. Now, if you ‘ls’ here, you can see your newly created file.
- cat: cat displays the file’s contents on your terminal window. Type “cat <previous file name>” and you’ll see the contents of the file.
- man: Using this tool, you can see the manual page of all the commands I’ve written before. To try, type “man cal” and you’ll see the manual page of “cal” and how to use that.
- sudo: sudo is a tool that gives you the super user privileges for a particular command. This can be helpful when using some privileged tool or file. Like for updating your system.
There are a hundreds of more commands and tools that can make your work easier, but these are some of the most used ones. The best way to get better at these commands is to use them again and again, even if you don’t feel like it.
If you want to suggest an edit, or get help on a command, please post a comment.