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:


 this command is used to display the file and sub-directories in the directory.
Syntax is [-options][directory-name]
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


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>


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


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


 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


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

File Oriented commands


 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


 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


 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


 this command is used to rename or move a file from one location to another.
Example mv Pankaj Shweta


 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


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


 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


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


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


This command displays the top of the specified file.

General purpose commands


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


This command is used to display the user who is you? ( WORKING on current terminals).
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


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

File search command


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]
Example find/home/Tom -m time 5-print


 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