L inux is basically a Unix-like Operating system, So Commands are important to run the terminal in Linux. Windows uses a command prompt li...
Linux is basically a Unix-like Operating system, So Commands are important to run the terminal in Linux. Windows uses a command prompt like that on Linux it is called a terminal or shell or Bash.
30.rm (remove):
The Terminal or Shell is used to run every command. So some of the Basic commands need to know before running in the terminal.
Basics Commands:
1. sudo -- Using sudo even non-root users can run any command with root privilege.
3. DATE:
To know the current date and time for the local machine.
Command: date
4. CALENDAR:
To Know the current calendar.
Command: cal
5. PWD - Present working directory
In Linux, Folders are called a Directory. we want to check the current working directory Run the PWD command in the shell.
Command: pwd
6. uname Command:
It is used to check the system information.
syntax: uname [OPTION]
In this command, some options are available for different use cases.
Options:
-a: It is used to check the system information in the order of (Kernel name, network node hostname, kernel release date, kernel version, machine hardware name, hardware platform, operating system).
-i, -m, -p: It is used to check the currently used hardware platform (architecture), hardware name, and processor type.
Command: uname -i , uname -m , uname -p
-o: It is used to check the currently used operating system's name.
Command: uname -o
-r: It is used to check the kernel release date.
Command: uname -r
-s: It is used to check the opertingsystem name.
Command: uname -s
-v: It is used to check the kernel's latest updated version.
Command: uname -v
7. whoami command
This command is used to check the currently logged-in user.
8. who: It shows the current active session details.
8(a) w: It shows the all the details such as currently logged in user details, from where(IP address), loggedin time, idle time,
9. last: It shows all the sessions details from the start.
11. clear: Clear the command line.
15. top -c: It is used to check the CPU usage.
Creating the Directory and files:
16. mkdir (make Directory)
It is used to make or create the directory.
Command: mkdir "directory name"
17. cd /: ( change directory)
It is used to switch one directory to another other words to change the directory.
18. cd .. It is used to step back one directory from the present working directory.19. touch: (creating the file)
It is used to create the files in the Linux machine.
Command: touch "filename"
20. ll and ls : (List the files and directories(folders))
ls command is used to list the files and directories in the Linux environment.
Command: ls (or) ll
and ls some options available check our blog for full details List command in Linux (ls, ll)
21.cat: It is used to view the content of the file from the first line to the last line(Ascending order).
22.tac: It is used to view the content of the file from the last line to the first line (Descending order).
23. Fileeditors ( used to edit the files)
In Linux, we have Three editors.
1. vi
2. vim
3. nano
vi (or) vim → Both editor options are the same.
vi and vim editor options
Press I to insert
Press the Esc button and then press shift+:
:q - quit
:w - save
:wq - save and quit
:wq! - save and force quit
5+d - delete all the content line by line
24. df (Disk Free)
The df command is used to check the disk usage space, and free space of internal and external disks.
Syntax: df [option] [filename]
Command: df
Options:
-h: it is used to show the file storage as human-readable.
Command: df -h
Command: df -h
-a: It is used to show all the files and folders even if it has zero block size.
Command: df -a
--total: It is used to show the total size.
Command: df --total
-i: It is used to show the inode information instead of blocks.
Command: df -i
-T: It is used to show the file system Type.
Command: df -T
we have covered some important commands and other few options available, Using --help to check the other options.
--help: It is used to show all the options and usage.
Command: df --help
25. du (Disk usage)
It is used to check the disk usage size for each file and directories.
Syntax : du [option] [file]
Options:
-a (all): It shows all the files and directories in the given path.
-c (Total): It shows the total size of the files and directories in the given path.
-h (human-readable): It shows the size as human-readable.
-s (summarize): It shows only the total size of the given directory or file.
--help: It is used to show all the available options.
26. ps (Process Status)
This command is used to check the process status and currently running process's id.
Command: ps
27. ps aux | grep bash -- checking the particular service process
Where
ps aux -- checking the current running process
“ | “(pipesymbol) -- run the two commands same time
grep -- to find
bash -- service name
28. kill:
It is used to kill the running process.
Command: kill -9 process id --> kill the particular process
29. Move and Copy (mv and cp)
In windows, we can use shortcuts to move and copy the files from one location to another location,
But in Linux, we are using commands to do the same.
Command: mv filename "dest path"
Move the text file:
Example: mv test.txt /home
Move the folder:
Command: mv Directoryname destination path
Example: mv test /home
Copy the folder
Command: cp -r foldername "despatch"
Example: cp -r testing1 /home/
Copy the files
Command: cp filename dest path
Example: cp test.txt /home
It is used to remove a particular file and directory.
Command: rm "file or directory name"
Options :
-rf - Remove the regular file.
-rd - Remove the regular directory.
31. rmdir (remove directory)
This command is used to remove the directory.
Command: rmdir "directory name"
User and Group Management:
32. useradd:
It is used to add a particular user to the local machine or server.
Syntax : useradd "username"
Example:useradd techie
33. passwd
The passwd command is used to update the password for the user.
Syntax: passwd "username"
Example:passwd "techie"
34. userdel
The userdel command is used to delete the user in Linux using the shell.
Syntax : userdel "username"
Example:userdel "techie"
35. Groupadd:
Adding the user to the group is an easy step, But should we need a group, so create a group.
Command: groupadd groupname
Now the group was created we need to add the existing user to the group.
Command: usermod -a -G groupname username
The " -a " flag tells usermod to add a user to a group.
The " -G " flag specifies the name of the secondary
To check the existing members in the group
Command: grep groupname /etc/group
To Remove a User From a Group:
Command: gpasswd -d username groupname
To Delete the group
Command: groupdel groupname
Command: groupdel groupname
Example:
groupadd techblog
usermod -a -G techblog techiev
gpasswd -d techiev techblog
groupdel techblog
We have more commands in Linux, To check the more commands in our next blog Mastering the Essentials: Important top 50 Linux Commands (Part 2) Explained and Demonstrated
----------------------------------------!!!! Happy Learning with Techiev !!!!!!!!----------------------------------
-------------------------Subscribe our Youtube Channel by clicking the below link----------------------
----------------------------!!https://www.youtube.com/@techieview729!!---------------------