The Linux terminal is a powerful tool that allows users to interact with their system through text-based commands. Whether you’re a beginner or an experienced user, having a grasp of basic terminal commands is crucial. In this guide, we’ll explore some essential Linux terminal commands along with explanations and practical examples.
The tar command is used for archiving and compressing files and folders.
tar -zcvf archive.tar filename
tar -zcvf archive2.tar filename1 filename2 filename3
tar -zcvf folder.tar folder/
The rm command is used to remove files and directories.
rm -r folder/
rm filename1 filename2 filename3
The ls command lists the contents of a directory.
ls -al
The history command displays previously executed commands.
history
history -c
The whoami command displays the current user.
whoami
The uname command provides system information.
uname -a
uname -r
The ping command checks network connectivity to a host.
ping -c4 orioninsist.org
The date command displays the current date and time.
date
The cp command is used to copy files and directories.
cp filename newfilename
cp filename /home/orion/
cp -r /home/orion/newfolder /tmp/newfolder
The mkdir command creates directories.
mkdir newfolder
The pwd command displays the present working directory.
pwd
The cd command is used to change directories.
cd Desktop
cd ..
The file command provides information about file types.
file filename.txt
The head and tail commands display the beginning and end of files.
head filename.txt
tail filename.txt
The echo command prints text to the terminal.
echo "new content" >> filename.txt
The more and cat commands display file content.
more filename.txt
cat filename.txt filename2.txt
The mv command moves or renames files and directories.
mv filename newfolder/
The wc command counts words, lines, and characters in a file.
wc -w filename.txt
wc -l filename.txt
The sort command sorts lines in files.
sort filename.txt
sort -k 2 filename.txt
The grep command searches for text in files.
grep "orion" filename.txt
grep -v "orion" filename.txt
These are just a few of the fundamental Linux terminal commands that can empower you to navigate and interact with your system efficiently. As you continue to explore the Linux terminal, you’ll discover even more commands and functionalities that can help you streamline your workflow and manage your system effectively. So, dive in, experiment, and become a master of the Linux command line!
⭐ GitHub: https://github.com/orioninsist/linux-basic
Also published here.