This article provides practical examples for 51 most frequently used commands in Linux
This is by no means a comprehensive list, but it should give you a jumpstart on some common Linux commands. You can bookmark this article for your future reference.
-
ls command
List files and folders in the current directory.
Parameters
–l
to list the content as a detailed list.
-a
Display all files (hidden + non-hidden).
You can combine parameters like this:
2.cd Command
Change directory from the current directory to another one.
3.cp Command
Copy the source to target.
Parameters
-i
Interactive mode means waiting for the confirmation if there are files on the target, it will be overwritten.
-r
Recursive copy means include subdirectories if they found.
Example
4. mv Command
Move the source to target and remove the source.
Parameters
-i
Interactive mode means to wait for the confirmation if there are files on the target, it will be overwritten.
Example
5.rm Command
Delete file or directory, and you must use –r in case you want to delete a directory.
Parameters
-r
Recursive delete means delete all subdirectories if found.
-i
Interactive means wait till confirmation
6.mkdir
Command – create or make new directories.
7.rmdir command – Delete a directory
8. ip command
– from Iproute2, a collection of utilities for controlling TCP/IP networking and traffic control in Linux.
9.df command
– display disk space usage.
10.du command
– estimate file space usage.
11. free command
– display memory usage.
12.scp command
– securely Copy Files Using SCP, with examples.
13. find command
– locates files based on some user-specified criteria.
15. ncdu command
– a disk utility for Unix systems.
16. pstree command
– display a tree of processes.
17. last command
– show a listing of last logged-in users.
18. w command
– show a list of currently logged-in user sessions.
19. grep command
– Search a file for a pattern of characters, then display all matching lines.
20. halt command –
Shuts down the system, but make sure to close all of your files to avoid data loss.
That was just some of the leading Linux commands.
Notice that, if you forget any command parameters, just type the command with – -help as a parameter, and it will list the used parameters, so you don’t have to remember all those parameters at the beginning.
21. reboot command – Reboot the system immediately. Just type reboot.
22. uptime command
– shows system uptime and load average.
23. top command
– shows an overall system view.
24. vmstat command
– shows system memory, processes, interrupts, paging, block I/O, and CPU info.
25. htop command
– interactive process viewer and manager.
26. dstat command
– view processes, memory, paging, I/O, CPU, etc., in real-time. All-in-one for vmstat, iostat, netstat, and ifstat.
27. iftop command
– network traffic viewer.
28. nethogs command
– network traffic analyzer.
29. passwd command – Used to change your user password.
30. du command –
Calculates the disk usage of a file or a directory.
Parameters
-h
Display human-readable form.
-s
Summarize the output total size.
Example
31. less command- Displays file content with a scroll screen so you can navigate between pages using PgUp, PgDn, Home, and End.
32. cat command – Display file content to screen without limits.
Example
33. date command – Simply prints today’s date. Just type date on the shell.
34. tar command –
Combines several files into an archive and compression if you want.
Parameters
-c
Create a new archive.
-z
Compress the archive using gzip package.
-j
Compress the archive using the bzip2 package.
-v
Verbose mode means showing the processed files.
-f
Write the output to a file and not to screen.
-x
35. updatedb command – updates the database used by the locate command.
36. locate command – To find a file in your system, the locate command will search the system for the pattern you provide.
37. chmod command –
Change the permission of a file or directory.
Parameters
The mode which consists of 3 parts, owner, group, and others means what will be the permissions for these modes, and you must specify them.
The permission is one of the followings:
Read =4
Write = 2
Execute =1
Every permission represented by a number as shown, and you can combine permissions.
38. chown command –
Change the owner of a file or directory.
Parameters:
-R
Capital R here means to change ownership of all subdirectories if found, and you must use this parameter if you use the command against a directory.
39. gzip command
– file compression and decompression.
40. b2zip
– similar to gzip. It uses a different compression algorithm.
41. zip command
– for packaging and compressing (to archive) files.
42. ps command
– information about the currently running processes.
43. cron command
– set up scheduled tasks to run.
44. nmcli command
– network management.
45. ping command
– send ICMP ECHO_REQUEST to network hosts.
46. traceroute command
– check the route packets take to a specified host.
47. mtr command
– network diagnostic tool.
48. nslookup command
– query Internet name servers (NS) interactively.
49. locate command – To find a file in your system, the locate command will search the system for the pattern you provide.
50. Sort by CPU Utilisation: Press (Shift+P) to sort processes as per CPU utilization
51. host command
– perform DNS lookups in Linux.
- An Introduction of GitLab Duo - December 22, 2024
- Best Hospitals for affordable surgery for medical tourism - December 20, 2024
- Top Global Medical Tourism Companies in the World - December 20, 2024