Commonly Used Linux Commands: File, Searching, System Information, and Networking Commands

Commonly Used Linux Commands: File, Searching, System Information, and Networking Commands

FILE COMMANDS

COMMANDFUNCTIONS
lsTo list out all the files in current directory.
ls -lTo list out all the files in current directory in a detailed manner.
cd directory/folder NameTo move into specified folder or directory.
cd . .To move into previous directory.
pwdTo print the current directory you are in.
ls -aTo show all the hidden files/folder.
mkdir folder-nameTo create a new directory/folder.
rmdir folder-nameTo remove an existing directory.
touch fileNameTo create a new file.
cat file-NameTo display the content of the file.
cat > file-NameTo create a file and edit it in command line, it will override the content if the file already exist.
cat >> file-NameTo edit a file content in command line without overriding (preferred).
cp source-file target-fileTo copy the content of source file into target file
mv file-name folder-nameTo move file into specified folder name.
mv file-one file-twoTo rename file-one into file-two.
rm file-nameTo remove a file, use this with caution as it will deleted permanently
rm -R folder-nameTo delete a folder permanently.
chmodchange permession of a file or directory
grep "search_term" file.txtsearch for a pattern in a file or set of files

SEARCHING COMMANDS

COMMANDFUNCTIONS
find /home/user/ -name "*.txt"This command searches for all files with a .txt extension in the directory /home/user/ and any of its subdirectories.
locate myfile.txtThis command searches for any files named "myfile.txt" on the system, using a pre-built database of file locations.
which pythonThis command displays the location of the Python executable file in the system's PATH.
historygrep "search_term"
find .finds all the files/folder in the present directory.
find . .Finds all the files/folder in the previous directory.
find . -type f -name “*.txt”find all the txt files present in the current directory.
find . -type f -name “file name”find file with specified name in the current directory.
find . -type f -mmin +5find all the files that were modified more than 5 minutes ago in the current directory.
find . -type f -mtime -10shows all files that were modified less than ten days.
find . -type f -size +1Mshows all the file that are more than 1 MB in size.
find . -type f -size +1Kshows all the file that are more than 1 KB in size.

SYSTEM INFO COMMANDS

COMMANDSFUNCTIONS
unamedisplay information about the system and kernel version.
dfdisplay disk space usage for file systems.
freedisplay information about memory usage.
topdisplay information about system resource usage in real-time.
psdisplay information about running processes.
uptimeshow uptime

NETWORKING COMMANDS

COMMANDSfunctions
pingtest network connectivity to a given host or IP address.
traceroutedisplay the route that network packets take to reach a given host or IP address.
nslookupquery DNS (Domain Name System) servers for information about a domain or hostname.
ifconfigdisplay network interface configuration information.
ipshow or manipulate routing, devices, policy routing, and tunnels.
netstatdisplay network connection information, routing tables, and interface statistics.
sshconnect to a remote system over a secure shell (SSH) connection.
scpcopy files securely between systems over a SSH connection.
curltransfer data from or to a server using one of the supported protocols.
wgetdownload files from the web.

Shortcuts for Terminal

Key Combination

Use

CTRL + C

To exit from Command Line

CTRL + A

To move cursor at start

CTRL + E

To move cursor at end

CTRL + K

To remove everything after the cursor

CTRL + R

For searching commands

TAB KEY

For autocompletion

Page Up/ Page Down

To navigate up and down for commands that were used

I hope this article helped you in a way. Follow me for a more detailed blog to help you in your development journey. Don't forget to share this blog with your friends.

You can also say other important commands in the comments that I have missed mentioning.

HAPPY LEARNING JOURNEY