Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Linux Commands Presentation

Linux basic commands

Uploaded by

bhoomika311.d
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Linux Commands Presentation

Linux basic commands

Uploaded by

bhoomika311.d
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Commands in Linux

10 basic commands used in Linux


$PWD (Print Working Directory)
• The pwd command in Linux is used to print the working directory. The
working directory is the current directory that you are in.

Syntax $pwd -[flags]


$pwd command flags
$pwd –L
it is the default PWD command
$pwd –P
Prints the physical directory without any symbolic links
$MKDIR(Make directory)
This command can create multiple directories at once as well as set the
permissions for the directories.

Syntax $mkdir –[flags] [Directory_name]


$mkdir Command flags
$mkdir –v :enables verbose mod, displays message for every directory
created.

$mkdir –p :allows for the creation of parent directory.


$mkdir command flags
$mkdir –m :This option is used to set the file modes/permissions.
$man(manual)
Provides access to the system’s reference manuals. These manuals
contain detailed information about commands, functions, and other
system components.

Syntax: $man –[flags] [command]


$man command flags
$man –f :this option gives the section in which the given command is
present.
$man command flags
$man –a :This option helps us to display all the available intro manual
pages in succession.
$man command flags
$man –k :This option searches the given command as a regular
expression in all the manuals and it returns the manual pages with the
section number in which it is found.
$ls (list)
$ls is a Linux shell command that lists directory contents of files and
directories.

Syntax: $ls –[flags] [File/directory]


$ls command flags
$ls -l :To show long listing information about the file/directory.

$ls –lh :display file size in easy-to-read format.


$ls command flags
$ls –lt :To sort the file names displayed in the order of last modification
time.

$ls –t :It sorts the file by modification time, showing the last edited file
first.
$cd (change directory)
$cd is used to change the current working directory

Syntax: $cd [directory]


$cd arguments
$cd / :to can change the directory to the root directory.

$cd ~ :to change the directory to the home directory from any location
in the Linux System.
$cd arguments
$cd .. :used to move to the parent directory of the current directory, or
the directory one level up from the current directory.
$rmdir(remove directory)
The rmdir command is used to remove empty directories in Linux.

Syntax: $rmdir –[flags] [directory]


$rmdir command flags
$rmdir –p :to delete a directory, including all the subdirectories

$rmdir –v :to display the message after removing the directory


$rmdir command flags
$rmdir [directory]* :to delete multiple directories if they have the
same expressions
$mv(move)
It Is used to move files and directories. It can also be used to rename
files and directories.

Syntax –[flags] [source] [destination directory/directory name]


$mv command flags
$mv –i :command ask for confirmation before overwriting an existing
file.

$mv –f :confirmation overwriting the destination file if a file is write-


protected.
$mv command flags
$mv –n :prevents an existing file from being overwritten.

$mv –b :take a backup of an existing file that will be overwritten as a


result of the mv command.
$cp(copy)
Is used to copy files and directories

$syntax: $cp [flag] [source] [destination]


$cp Command flags
$cp –i :the system first warns the user before overwriting the
destination file.

$cp –r :Copying directory structure recursively.


$cp Command flags
$cp * :The star wildcard represents anything i.e., all files and
directories. Suppose we have many texts documents in a directory and
want to copy it to another directory, it takes lots of time if we copy files
1 by 1 or command becomes too long if specify all these file names as
the argument, but by using * wildcard it becomes simple.
$touch
It is used to create a file without any content. The file created using the
touch command is empty.

Syntax: $touch [flags] [file name]


$touch command flags
$touch –a :is used to change access time only.
$open command flags
$touch –c :is used to check whether a file is created or not. If not
created then don’t create it.
$open command flags
$open –m :used to change the modification time only.
$touch command flags
$touch –d :This command is used to change only modification date
$find
Allows users to search by name, size, modification time, or content.

Syntax: [path] [options] [expression]


$find [path] –name *: discovering files within a directory that adhere
to a specific naming pattern.

$find [path] –type : parameter is used to specify the file type.


$find [path] –newer: searching the files which are newer than the
mentioned

$find [path] type –d: The above command will find the ‘Newdirectory’
location

You might also like