sudo su command: - is often used to switch to the superuser or root account to perform administrative tasks. This command stands for “superuser do,” and it lets you act as a superuser or root user while you’re running a specific command. It’s how Linux protects itself and prevents users from accidentally modifying the machine’s filesystem or installing inappropriate packages. Sudo is commonly used to install software or to edit files outside the user’s home directory: It’ll ask you for the administrator’s password before running the command you typed after it.
apt update command:-The command apt-get update is used to update the package index files on the system, which contain information about available packages and their versions. It downloads the most recent package information from the sources listed in the "/etc/apt/sources. list" file that contains your sources list. To update the packages using apt-get update use the following command:
apt-get update/apt update
apt install : - This command allows you to install packages from the distribution's software repositories. After typing "apt install," you would typically provide the name of the package you wish to install. For example, to install the "nginx" package, you would use the following command:
apt install azure-cli
ls Command:-ls is probably the first command every Linux user typed in their terminal. It allows you to list the contents of the directory you want (the cucd rrent directory by default), including files and other nested directories.
pwd Command:-The pwd command stands for “print working directory,” and it outputs the absolute path of the directory you’re in. For example, if your username is “john” and you’re in your Documents directory, its absolute path would be: /home/john/Documents.
cd Command:- It refers to “change directory” and, as its name suggests, switches you to the directory you’re trying to access. The cd command is highly popular, along with ls. For instance, if you’re inside your Documents directory and you’re trying to access one of its subfolders called Documents, you can enter it by typing:
cd Desktop
You can also supply the absolute path of the folder
cd /home/joeubuntu/Documents
There are some tricks with the cd command that can save you a lot of time when playing around with it:
1) Go to the home folder: type cd+one space
Cd
2) Move a level up: documents folder is removed from /home/joeubuntu/Documents
cd ..
3) Return to the previous directory
cd –
mkdir Command:- The command is use to create folders, i.e to make directory folder. Just specify the new folder’s name, ensure it doesn’t exist, and you’re ready to go. For example, to make a directory to keep all of your images, just type:
mkdir Films/
To create subdirectories with a simple command, use the parent (-p) flag:
mkdir -p Films/2004/
Vim Command :- it’s a command use to create, make and edit a next file. To create a file use
To make a file and Edit (follow the below description)
a. Input vim my name (my name text doc created).
b. To edit:- Blank space will be opened, press “I” on the keyboard to enable “editing” i.e. INSERT texts to the file.
c. Press the ESC button to leave the inert mode.
d. To save, press Shift colon and type :wq and enter. File saved,
e. To exit or quit. Do control C, then type :qa and enter
Note: touch and nano commands can also be used to create txt files in Linux.
Touch :- to create a file: use touch file1.txt file2.txt file3.txt
cp Command:- It’s use to copy files and folders directly from one directory to another. In the Linux terminal, sometimes it can replace conventional file managers. To use the cp command, just type it along with the source and destination files:
cp my.txt file1.txt
The command “cp” copy content (this how to use vim) from file “my” to “file1.txt”.
cp file1.txt tests
The command above copied text file file1.txt to tests folder.
rm Command:- You can use the rm command to remove files and directories. Be careful while using it, though, because it’s very difficult (yet not impossible) to recover files deleted this way.
To delete a regular file, you’d type:
rm file2.txt
If you want to delete an empty directory, you can use the recursive (-r) flag:
rm -r Films/
On the other hand, to remove a directory with content inside of it, you need to use the force (-f) and recursive flags:
rm -rf tests/
Tests dir with content*_ file1.txt_*
cat Command:- Use to view the contents of a text file.
Cat
Exit command:- use to terminate terminal current section and return to the root environment.
Clear command:- its use to clear screen or the terminal content.
After executing the clear command.
History command:- its to display lists of already executed commands, i.e. previous commands executed.
LETTER OF CONGRATULATION TO MYSELF
Top comments (0)