Linux Command Line

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

The 

Linux command line, also called a terminal, shell, or console, is a text interface for your computer. With this
computer program, you can interpret commands and write your own scripts.

What is the Linux Command Line?


The Linux terminal gives you an interface where you can input commands and see the result printed as text. You can use the
terminal to accomplish tasks like moving files or navigating a directory, without the use of a GUI. Terminals just transfer
information. You need a shell for the operating system to understand this information.
With the Linux command line, you can execute commands manually by typing on the terminal. You can also automate
commands using Shell Scripts.
 

Brief History of Linux Command Line


Let’s briefly go through the Linux command line history. Back in the early days of computing, there was an operating system
called Unix, which was designed to run on mainframe computers as a multi-user system. Users connected to it remotely
through terminals.
These terminals were very basic, as they could only send keystrokes and display data on the screen.
Since text is light on resources, users could interact quickly and efficiently. Every task the users performed was through this
textual interface. To coordinate the execution of different programs, users would connect to single master programs.
The user commands were wrapped in “shell” programs. To make complex tasks easier, users could write shell scripts that
automated a long series of shell commands.
Linux is a descendant of Unix. Its core part is designed to behave similarly to a Unix system. The Bourne Again Shell
(BASH) was developed by Stephen Bourne and released in 1979 in the Version 7 Unix release. Over time, it has become the
default shell for Linux systems.
 

How to navigate files


Now that you have seen the terminal, let’s try out a few basic commands. Commands are the instructions you give to your
computer to do something.
Click the window to ensure your keystrokes go there. The odd text you see on the terminal is called prompt. It is the
computer’s way of saying that it’s ready to accept a command.

pwd
Type in the command below and hit Enter.
When you launch the terminal, you are in the home directory of your user. This usually looks something
like “/home/username”. The pwd, print working directory command lets you know which directory you are in.
The path it gives is the absolute path. The absolute path starts from the root, which is the base of the Linux file system. This is
denoted by the slash /.
 

ls
Another common command is ls. This command is used to display all the directories and files in your current directory,
type ls and hit enter.
 
 
To view any hidden files, add –a to the command.
 

 
You can add more options to the command to view specific information.
 
Options Description
ls -X sort by extension name
ls -t sort by time & date
ls -s list file size
ls -S sort by file size
ls -r list in reverse order
ls -R list recursively directory tree
ls -ls list with long format with file size
ls -lh list long format with readable file size
ls -la list long format including hidden files
ls -l list with long format - show permissions
ls -d list directories - with ’ */’
 

cd
Next, we’ll look at the cd, change directory command. Your current directory is where you are currently working, in our
case /home/maryam. Before we start with changing directories, let’s go over what absolute and relative paths are.
An absolute path starts from the system root and a relative path from your current directory. So the absolute path for
Documents will be /home/Maryam/Documents, whereas the relative path will be Documents.
To change directories, use:

 
Let’s change our directory to Documents using both the relative and absolute paths, respectively.
 
 

 
https://www.educative.io/blog/linux-command-line-tutorial?
aid=5082902844932096&utm_source=google&utm_medium=cpc&utm_campaign=blog-
dynamic&gclid=EAIaIQobChMIq_309djX7wIVxkXVCh3fEA8tEAAYASAAEgJwIvD_BwE

You might also like