Linux Commands

Following is the complete list of linux commands. To know more about any of the following commands, run $ info <command> . The terminal shows you all the options associated to the command with detailed description.

CommandDescriptionUsage
apt-getCommand-line tool for handling packages, and may be considered
the user’s “back-end” to other tools using the APT library.
$ apt-get install <package_name>
catCopies each FILE (‘-’ means standard input), or standard input if
none are given, to standard output.
$ cat content.txt
cdTakes you to a directory$ cd /home/local/
chmodChanges the access permissions of the named files.$ chmod 755 content.txt
cpcopies files (or, optionally, directories). The copy is completely
independent of the original. You can either copy one file to another,
or copy arbitrarily many files to a destination directory.
$ cp file.txt /home/user/
dfReports the amount of disk space used and available on file
systems.
$ df
duReports the amount of disk space used by the set of specified files
and for each subdirectory (of directory arguments)
$ du
echoWrites each given STRING to standard output, with a space between
each and a newline after the last one.
$ echo ‘HELLO’
findSearches the directory tree rooted at each file name FILE by
evaluating the EXPRESSION on each file it finds in the tree.
$ find -iname “HelloWorld.java”
grepPrints lines that contain a match for a pattern$ grep -r “arjun” *
hostnamePrints the name of the current host system. With one argument, it sets
the current host name to the specified string. You must have appropriate privileges to set the host
name.
$ hostname
$ hostname ‘Arjun’
$ hostname -I
locateFor each PATTERN given ‘locate’ searches one or more file name
databases returning each match of PATTERN.
$ locate *mp3*
lsLists information about files (of any type, including
directories).
$ ls
manAn interface to the on-line reference manuals$ man
mkdirCreates directories with the specified names$ mkdir NewDirectory
mvMoves or renames files (or directories).$ mv file.txt /home/user/samples/
nanoGNU ‘nano’ is a small and friendly text editor that comes by default
with linux.
$ nano content.txt
pingUses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.$ ping ‘www.google.com’
pwdPrints the name of the current directory$ pwd
rmRemoves each given FILE. By default, it does not remove
directories.
$ rm textfile.txt
rmdirRemoves empty directories$ rmdir NewDirectory
sedsed is a stream editor. In a DOS file you could find \r\n in the end of each line. sed command converts the DOS file format to Unix file format.$ sed ‘s/.$//’ <filename>
shutdownShutdown may be used to halt, power-off or reboot the machine.$ shutdown -h now
sortSorts, merges, or compares all the lines from the given files, or
standard input if none are given or for a FILE of ‘-’. By default,
‘sort’ writes the results to standard output.
$ sort <sample.txt>
$ sort sample.txt
sshProgram for logging into a remote machine and for executing commands on a remote machine. It is intended to provide secure encrypted communications between two untrusted hosts over an insecure network.$ ssh -l arjun ‘www.google.com’
sudoAllows a permitted user to execute a command as the superuser or another user, as specified by the security policy.$ sudo rm textfile.txt
tarTar stores and extracts files from a tape or disk archive.$ tar -cvf images.tar /home/arjun/images/
$ tar -xvf images.tar
touchChanges the access and/or modification times of the specified
files.
$ touch file.txt
unamePrints information about the machine and operating system it is
run on.
$ uname
viIt can be used to edit all kinds of plain text. It is especially useful for
editing programs.
$ vi HelloWorld.java

Conclusion

We have learnt about all the Linux Commands in this tutorial.