Basic Linux Commands and Their Usage
cat
To view what's written in a file
chmod
File permissions consist of three types: read, write, and execute, each represented by the letters r, w, and x, respectively. The chmod
command allows you to set or change these permissions for a file or directory
history
Display a list of previously executed commands in the current shell session
rm -r
Used to recursively remove directories and their contents. It is a powerful command that can delete a directory and all its subdirectories and files contained within them.
cat > fruits.txt
& cat fruit.txt
To create a fruits.txt file and view content inside it. By cat
, it allows you to add content in fruits.text and by Ctrl + D
you can exit from fruits.text
vim devops.txt
Add content in devops.txt. To insert something press i
then add your content. To save and quit the file, press esc
and then type :qw
or :x
to save the changes and exit the editor
head -3
Display the first three lines of a file. The -3
option in head -3
specifies the number of lines to display. You can adjust the number as needed to show a different number of lines
tail -3
Display only bottom three lines from the file
ls
Used to list files and directories in a directory. It provides information about the files and directories present, such as their names, permissions, sizes, and timestamps
sudo
Allows authorized users to execute commands with administrative or superuser privileges. It stands for "Superuser Do"