Hello friends, Here u can find the most useful & frequently required Commands on Linux terminal . This post is basically for those who just started operating Linux OS. These commands are executed on Ubuntu 16.04 OS. To learn these commands, open terminal by pressing keys CTRL + ALT + T simultaneously.
ls with no option shows the list files and directories in bare format of current directory. It won’t shows details like file types, size, modified date and time, permission and links etc.
To display file and directories
To display hidden files
To display all files and directories with size
To display Recursively list of Sub-Directories
To Sort Files by File Size
To shows latest modification file or directory date as last.
mkdir is used to create directories on a file system.
Syntax : mkdir directory_name Example : mkdir tutorials
It allows you to change your working directory. You use it to move around within the hierarchy of your file system. The double-dot (“..”) directory notation can be used anywhere in a directory name to represent going up one level.
Syntax : cd directory_path Example : cd /home/user_name/documents cd ..
cd .. commands moves to its parent directory as /home/username
The mv command is used to move or rename files. mv renames file SOURCE to DEST, or moves the SOURCE file (or files) to DIRECTORY.
Syntax : mv filename destination-directory Examples : mv file.txt /home<br>
The cp command is used to make copies of files and directories.
Syntax : cp [OPTION]... SOURCE... DIRECTORY cp origfile /directory/subdirectory Example : Copy multiple files into another directory, using a wildcard: cp file*.jpg /directory/subdirectory Copy an entire directory structure into another location: cp -R /one/two /three/four
You can use cp to copy entire directory structures from one place to another using the -R option to perform a recursive copy.
The rmdir utility removes the directory entry specified by each directory argument, provided the directory is empty.
Syntax: rmdir directory_name Example: rmdir tutorials
rm command is used to delete files from a file system. Usually, on most file systems, deleting a file requires write permission on the parent directory and execute permission.
Syntax : rm file1 file2 file3 Example : To remove single or multiple files rm abc.txt pqr.txt xyz.txt To remove all files & subdirectories from a directory (u can delete non empty directory) rm -rf mydir -f: Forcefully remove file -r: Remove the contents of directories recursively
ifconfig is used to configure, or view the configuration of, a network interface. ifconfig stands for “interface configuration”. It is used to view and change the configuration of the network interfaces on your system. It will display information about all network interfaces currently in operation.
To activate eth1 sudo ifconfig eth1 up
To deactivate eth1 sudo ifconfig eth1 down
ping(Packet INternet Groper) is a simple way to send network data to, and receive network data from, another computer on a network. It is frequently used to test, at the most basic level, whether another system is reachable over a network, and if so, how much time it takes for that data to be exchanged. It is the best way to test connectivity between two nodes.
Example: ping www.yahoo.com
It stands Network Statistic (Netstat) command to display connection info, routing table information, Tcp, Udp port, protocols information.
To displays routing table information netstat -r To display TCP Ports connections netstat -at To display UDP Ports connections netstat -au To display Statistics by Protocol netstat -s To get netstat information continuously netstat -c
Pidof finds the process id’s of the named programs. It prints that id’s on the standard output.
Example : To find process id of running process pidof process_name pidof gedit it return process id of running instance of gedit program. i.e process
kill is used to send a signal to a process. The default signal for kill is TERM (which will terminate the process). To test this command, just open gedit editor.
Syntax : kill processid Example : pidof gedit if it return process id as 9378, pass it as parameter to kill command. kill 9378
traceroute is a network troubleshooting utility which shows number of hops taken to reach destination also determine packets traveling path. Traceroute is a utility that records the route through the Internet between your computer and a specified destination computer. It also calculates and displays the amount of time each hop took.
Example: traceroute google.com
The df command reports the amount of used and available disk space on file systems.
Example : To display size in human readable form as KB,MB,GB.. df -h To grand total of used , available size of all disks on file system. df -total
all above are the most useful Linux commands for beginners with required options. if u want more options of these commands , just write command name and option –help, as show in example below.
Example : df --help