basic-linux-commands-cheat-sheet-with-examples

Telechargé par monovm703
Basic Linux Commands Cheat Sheet With Examples [Updated]
Basic Linux Commands Cheat Sheet With Examples [Updated]
Check out these basic Linux commands cheat sheet with examples to perform or increase your
speed/productivity while executing any Linux task/program.
Server Tutorials - Aug 30, 21 - by Susith Nonis - 14 min Read
List of content you will read in this article:
1. Basic Linux Commands Cheat Sheet
2. Conclusion
Linux is an Operating System that is widely used by developers for making all kinds of applications. In order to
accomplish these applications, it is necessary to have a good understanding of basic Linux commands with
examples that will be used in hundreds of tasks. The below section introduces a few basic Linux commands cheat
sheet that will be helpful for every person using Linux.
Basic Linux Commands Cheat Sheet
PWD Command [Print Working Directory]
In Linux, “Print Working Directory” is abbreviated as
pwd
.
PWD command prints the path to the current working directory, beginning at the root.
The root node is the initial node in the Linux directory hierarchy.
pwd is either a shell command (pwd) or a binary (/bin/pwd).
$PWD is an environment variable that stores the path to the current directory. This
variable can be printed using the
echo
command.
There are two flags for this command.
pwd -L is a command that prints the symbolic path.
pwd -P: Prints the actual path. Let’s see an illustration for the command.
PS Command
This is an important terminal command in Linux that will allow you to check what
processes are currently executing on your system. Processes are just running instances
of the operating system's applications.
It's a simple yet powerful method for evaluating system resources, and it allows you to
control system operations directly from the terminal. This command also prints the
process's PID, which can be used to terminate the process.
This is one of the simplest and most efficient Linux monitoring tools available to Linux
enthusiasts.
Locate Command
You may use the
locate
command to hunt for a file by name.
It functions similarly to the search command, except that it operates in the background.
The
locate
command analyses the database, whereas the
find
command explores the
file system.
The
locate
command can be used from any location inside the operating system.
It's more efficient than using the
search
command.
If you wish to use the
locate
command to find the file, keep your database up to date.
Head Command
In order to view the beginning of a file, use the head command.
Among Linux users who do a lot of text processing, this is one of the most common
Linux commands available.
When working with a large number of files at the terminal, use this command to avoid
confusion.
It publishes the top 10 lines of the files by default. It's possible to print a certain number
of lines by using the -n option. Check out an example of this command in action!
Tail Command
The tail command, as a complement to the prior command, is likely to be used far more
frequently than the header commands.
tail, along with cat and echo, is a simple Linux terminal command that can accomplish
things you wouldn't expect. Let’s see an example of using these commands.
Less Command
The
less
command is also frequently used for analysing the contents of a file due to its
ease of use. Users can navigate a file in both directions by using less rather than
cat
commands, and the terminal session is not interrupted.
Kill Command
Kill Command is a powerful tool for terminating programmes that have been stuck due
to a shortage of resources.
The importance of this command will become clear as your understanding of the Linux
operating system increases.
The kill command, which appears regularly on lists of funny Linux commands, is as
strong as its name implies.
The command's syntax is as follows:
kill PID
Where PID is the ID of the process we need to kill.
Let’s see an example of this command.
Sort Command
To sort a file, sort is used to arrange a certain order for the records. This command sorts
files by default, assuming that the contents is ASCII. It may also be used to sort
numerically using parameters in the sort command.
CMP Command
The cmp command will allow you to compare two files and publish the results to the
standard output stream. This, along with the comm command, is one of the best Linux
commands by users who regularly process huge amounts of text files.
MV Command
Short for a move, it’s a compliment to the cut operation you do in the GUI.
Just like cp, you may use the mv command to move either single or many files from one
location to another.
With the -f option, you may compel this Linux programme to transmit big files.
CD Command
In Linux, the cd command is known as the “change directory” command.
It's used to switch to a different working directory.
To go back to the previous directory, you may use:
cd ..
and to go to some sub-directory, you could use:
cd [directory name]
1 / 15 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !