Tuesday, July 24, 2018

What is Linux commands

What is Linux commands

                      Linux commands

A command is an instruction given to the shell; the kernel will obey that instruction. Linux provides several commands for its users to easily work with it. The important Linux commands are grouped according to their function as a fellow.
Directory Oriented command:

  ls

 this command is used to display the file and sub-directories in the directory.
Syntax is [-options][directory-name]
Example
ls
ls-r
ls*s(it also supports wild character('*' and'?'))
*mkdir: This command is used to make (create) new directories.
Syntax mkdir<directory-name>
Example mkdir harsh

rmdir  

this command is used to remove(delete) the specified directories. A directory should be empty before removing it.
Syntax. rmdir<directory-name>
Example rmdir< TOM>

 cd: 

this command is used to change the current working directory to a specified directory.
Syntax cd< directory-name>
Example cd/home/harsh
cd.

 pwd

 this function (disk usage) command displays the full path names for the current working directory.
Syntax pwd
Example*pwd

du

 this du (disk usage) command report the disk spaces that are consumed by the files in a specified directory, including all its subsidiaries.
Syntax. = du[ -options] [ directory-name] options:
Example du
du-a

df

 this df(disk free) command report the available Free space on the mounted filesystem(disks).
Syntax df[-options]

File Oriented commands

 Cat

 the cat command is used to display the contents of the specified Fi(s).
Syntax= 1cat[file name 1 ]
                2cat>[file name]
Example *cat harsh
                  * cat neeraj

 CP

 this command is used to copy the content of one file to another. If the destination file is an existing directory, the file is copied into that directory.

Syntax= cp [source file][destination file]
Example * cp harsh Pankaj

 rm

 this command is used to remove (delete) a file from the specified directory.to remove a file, you must have written. Permissions for the directory that contains the file, but you need not have permission on the file itself.
Syntax=rm[file name]
Example rm Tom

mv

 this command is used to rename or move a file from one location to another.
Syntax=[source][destination]
Example mv Pankaj Shweta

Wc

 this command is used to count line(l), words(w)and character(c) of information stored on the specified file.
Syntax=wc[-options][file name]
Example wc-1tom

File Access Permissions

 chmod 

 This command is used to change the file permissions for an existing File.
Syntax
1 chmod three-digit-number [file name(s)]
Example chmod u+r,g-x,o+rw[file]

 chown

 this command is used to change the owner of a specified file only the owner of the file and superuser can change the file ownership.
Syntax=chown[new-owner](file name)
Example= chown harsh xyz

chgrp

This command is used to change the group ownership of a specified file.o not the owner of the file and super user can change the file ownership.
Syntax= chgrp[new-group-name](file name)
Example chgrp blic ABC.txt

 Tail

This command displays the end of the specified file. Syntax=tail+n(file name)
number of lines
Example= tail +4abc.txt.

Head

This command displays the top of the specified file.
Syntax=head-n[file-name]
Example=head-3Ajay.dat

General purpose commands


data

This command displays the system's date and time.
Syntax= data+℅D(Data=MM/DD/YY)

who

This command is used to display the user who is you? ( WORKING on current terminals).
Syntax=who
Example who dir name

who am i

This command displays the syntax and details usage of Linux command which is supplied as the argument.
Syntax=man[Linux command]
Example=man data
*

lpr

This command is used to print one more file on the printer.
Syntax= lpr[file name]
Example lpr Tom.txt

File search command

Find 

this command recursively examines directory tree to look for file matching some file attributes and then takes some specified action on those files.

Syntax=find [path -list][selection-criteria][action]
Selection
Example find/home/Tom -m time 5-print

Grep

 the grep(global search for regular expressions( command is used to search for a specified pattern from a specified file and displays those lines containing the pattern.
Syntax=grep[-option] pattern[file name]
Example grep I comp Tom.dat