Introduction to Linux - Command line

- 3 mins

Series


Index


Introduction

I always encourage people they should use Linux 🐧 as it is an easy yet powerful environment as an operating system. For that reason, I am starting a series on the Linux operating system. although Linux dominates the server world, I hope one day it will go as a mainstream operating system. On this tutorial, I will write about the powerful command line tools of Linux.


The Shell

In Linux, the shell interprets commands and script files. There are several shells out there, but most commonly used shell is Bourne-Again shell (sh or bash) and C Shell (csh). Each has its own features sets and way of interpretation but they all share same category of features.

Bourne-Again shell is the default shell for most Linux distributions.


Terminal

Normally most people use operating system with a Graphical User Interface (GUI) for their daily works. GUI interpret its commands and talk to operating system. Terminal cut the GUI as middle translator and talk directly with OS kernel. So command is much faster, error free but a bit risky.

Some commonly used Linux terminal emulators are-

To launch a terminal widely used command is  +  + 

If you want the location of emulators you can find it within the directory /usr/share/applications


Commands and execution

When you open a terminal you will see a blinking vertical line. This is called Command Prompt. Default command looks like this-

	nabil@pc:~$

The breakdown of the composition is-


Now you should use some command to get the flavor. On your terminal type and press or

	echo "Hello world!"

This will echo out the text on the command.

Next try following commands one by one-

	pwd
	ls

pwd stands for Present working directory, that means current path of the directory.

ls stands for List. It shows list of files on the current directory. ls accept second arguments for extended use cases. Some of example are given below-

	#Here Downloads and Documents are directory names. 
	#This command will print out the list of files within this two directory
	ls Downloads Documents
	
	#Same as before, but this time instead of directory name we are using complete path
	ls usr/share

	#'a' means all. This will show all files including hidden ones. In hidden file has . as prefix
	ls -a

	#'l' specify to show a list with detailed information.
	ls -l

	#'t' shows a list sorted by last
	ls -t

	#we can use all previous options in one command
	ls -alt

If you want command line history you can use them by pressing for previous commands or for next commands.

If the terminal is clogged up with lots of inputs use clear command to clear the terminal.

	clear

If you forget exact spelling of the command; use the built-in auto-complete command by pressing .


Conclusion

That’s all for an introduction. In next tutorial I will show how to search through file system.


comments powered by Disqus
rss facebook twitter github youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora