Professional Documents
Culture Documents
Welcome to the next practical series of Linux Administration Lab. In this practical we are
going to start with beginners commands, the commands that we can use for general purposes.
I hope you all are installed with the Linux operating system. The main mode of access to a
Linux machine is through a terminal. For each terminal connected to a computer, the kernel
runs a process called a tty that accepts input from the terminal.
Every Linux system has a main console that is connected directly to the machine. The
console is a special type of terminal that is recognized when the system is started. And the
console is that where we can pass the commands to operate the Linux system is Terminal.
The easiest way with which you can open terminal by taking following steps:
So, before proceeding to commands let’s first learn to write a command in the terminal:
Where,
Command name is the name of the program you want the shell to execute. Commands are
case sensitive.
Option usually indicated by a dash (-), that allows you to alter the behaviour of the command
Arguments are the names of the files, directories or programs that command needs to access.
Note: [ ] brackets signify that they are optional part and can be used as per requirement
• who: Linux maintains the account of all the users of the system. This command displays
whole information about all the users that have logged into the system.
Syntax: who
Output: user pts/0 2:36
• whoami: Linux identifies the invoking user and lists the user name, terminal line and the
date and time of login.
Syntax: whoami
Output:
• echo: It is an external command that is used to display each and everything we write.
• cal: The cal command is used to display the calendar for the current year if no argument
is passed.
Syntax: $cal
Output:
• date: The date command is used to display current date and time. Date is displayed in
the format day-month-year.
Syntax: $date
Output:
• man: These are manual pages. It is used to get the detailed overview of any command.
Syntax: $man
Output:
Syntax: $history
Output:
Syntax: $script
Output:
• uname: It prints the name, version and other details about the current machine and the
operating system running on it.
Syntax: $uname
Output:
• info: It will give detailed information for a command written as a argument.
Syntax: $info
Output:
•
• help: Inputting the help command will show you all brief information about the
command you are using.
Example: $cal -h
Output:
Syntax: $uptime
Output:
• clear: The clear command does exactly what it says. The clear command clears the
screen and wipes the board clean. To use the clear command simply type clear.
• ls: It is used to display the listing of files and directories in current directory
Syntax: $ls
Output:
• cat: It is used for various tasks, Here we will use it for creation of a file
Output:
• gedit: It is a graphical user interface editor with which file can be create
Output:
Output:
• pwd: It stands for Print Working Directory. It tells us about our current location
Syntax: $pwd
Output:
• mkdir: It stands for Make Directory. Used to make a directory in the current directory.
Output:
• cd: It stands for Change Directory. IT is used for shifting directory from one to another.
Syntax: cd DirectoryName
Output:
• rmdir: It stands for Remove Directory. As its name suggests, it is used for deleting a
directory.
Output:
• cp: This command is used for copying the contents from one place to another
Example:
• mv: This command is used for moving the contents of file or directory from one place to
another.
Output:
Vi Editor:
• It is a command based editor, which means to operate this editor one must know the
commands of vi-editor.
• It stands for Visual Editor.
• Basically, it is used for creating files and manipulating its content.
As it is entirely a command based editor, so, here are the categories of commands that are
there in Vi-Editor.
1. Editing Files
• i --- Inserts text before current cursor location.
• I --- Inserts text at beginning of current line.
• a --- Inserts text after current cursor location.
• A --- Inserts text at end of current line.
• --- Creates a new line for text entry below cursor location.
• --- Creates a new line for text entry above cursor location.
1. Deleting Characters:
• x --- Deletes the character under the cursor location.
• X --- Deletes the character before the cursor location.
• dw --- Deletes from the current cursor location to the next word.
• d^ --- Deletes from current cursor position to the beginning of the line.
• d$ --- Deletes from current cursor position to the end of the line.
• D --- Deletes from the cursor position to the end of the current line.
• dd --- Deletes the line the cursor is on.
2. Moving within a File
References:
1. https://www.howtogeek.com/140679/beginner-geek-how-to-start-using-the-linux-terminal/
2. https://www.linuxforfreshers.com/p/vi-editor-vi-stands-for-visual.html