Linux Command Line
Linux Command Line
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.
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