Linux Shell Basics Part1
This tutorial is a brief introduction
to the LINUX SHELL programming
First of all What is a Terminal in
Linux?
Terminal is an Interface for Linux
where you can Enter your commands and execute them. This is similar
to the Command Prompt Application in Windows Operating Systems.
This Helps you to perform various
operations like File Manipulation,Process management, Memory
Management ,etc.
Now Lets get started to see How to Work
with Terminal. The Terminal Window Shown Below is the Terminal Window
of Ubuntu.
To View the Terminal in Ubuntu Press
CTRL + ALT + T.
As You can See in the Above Image.
You Have something like
“kamar@kamar-Aspire-E1-531”
here “kamar”
is the username of my Ubuntu OS and “kamar-Aspire-E1-531”
is my Laptop Name.
Now You Will Study the First Command
“ls”
The Command “ls” is used to display
all the Files and Directories in your Current Folder that is
“home/kamar” as my username is
“kamar”
Just type “ls”
and Press Enter
As You can see in the above image it
Displays the name of the Directories like Templates,Videos,Ubuntu
One,etc and Also it Displays Files like kamar.kmy, and .mp3 file etc
There are various Options for the ls
command like
-a |
Shows you all files, even files that are hidden (these files
begin with a dot.) |
-A |
List all files including the hidden files. However, does not
display the working directory (.) or the parent directory (..). |
-b |
Force printing of non-printable characters to be in octal \ddd
notation. |
-c |
Use time of last modification of the i-node (file created, mode
changed, and so forth) for sorting (-t) or printing (-l or -n). |
-C |
Multi-column output with entries sorted down the columns.
Generally this is the default option. |
-d |
If an argument is a directory it only lists its name not its
contents. |
-f |
Force each argument to be interpreted as a directory and list
the name found in each slot. This option turns off -l, -t, -s, and
-r, and turns on -a; the order is the order in which entries
appear in the directory. |
-F |
Mark directories with a trailing slash (/), doors with a
trailing greater-than sign (>), executable files with a
trailing asterisk (*), FIFOs with a trailing vertical bar (|),
symbolic links with a trailing at-sign (@), and AF_Unix address
family sockets with a trailing equals sign (=). |
-g |
Same as -l except the owner is not printed. |
-i |
For each file, print the i-node number in the first column of
the report. |
-l |
Shows you huge amounts of information (permissions, owners,
size, and when last modified.) |
-L |
If an argument is a symbolic link, list the file or directory
the link references rather than the link itself. |
-m |
Stream output format; files are listed across the page,
separated by commas. |
-n |
The same as -l, except that the owner's UID and group's GID
numbers are printed, rather than the associated character strings. |
-o |
The same as -l, except that the group is not printed. |
-p |
Displays a slash ( / ) in front of all directories. |
-q |
Force printing of non-printable characters in file names as the
character question mark (?). |
-r |
Reverses the order of how the files are displayed. |
-R |
Includes the contents of subdirectories. |
-s |
Give size in blocks, including indirect blocks, for each entry. |
-t |
Shows you the files in modification time. |
-u |
Use time of last access instead of last modification for
sorting (with the -t option) or printing (with the -l option). |
-x |
Displays files in columns. |
-1 |
Print one entry per line of output. |
pathnames |
File or directory to list. |
Now Lets Learn Another Command “pwd”
“pwd” stands for Present Working Directory
This Command Will Display the Complete path of the Present Working Directory
In Above Image you can see that the terminal displays “/home/kamar” as it is my current working Directory.
Now If your Username is Something Like “xyz” it would display “home/xyz”
To Be Continued.....
Comments
Post a Comment