This Linux commands are useful for everyone starting out. It is useful for day to day operations when doing Linux stuff. We are going to explore a number of them during this tutorial. So stay tuned.
File Permission Commands
Let us first understand permission groups available.
Every file and directory has three user based permission groups.
- owner – The Owner permissions apply only the owner of the file or directory, they will not impact the actions of other users.
- group – The Group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users.
- all users – The All Users permissions apply to all other users on the system, this is the permission group that you want to watch the most.
Permission Types
We have the following permission types:
- read (r)– The Read permission refers to a user’s capability to read the contents of the file.
- write (w)– The Write permissions refer to a user’s capability to write or modify a file or directory.
- execute (x) – The Execute permission affects a user’s capability to execute a file or view the contents of a directory.
use the following command to see the permissions.
$ ls-l
From the above you can see that i only have read and write permission.
Linux Directory Commands
- pwd is used to display the location of the current working directory.
- mkdir is used to create a new directory under any directory.
- rmdir is used to delete a directory.
- ls is used to display a list of content of a directory.
- cd is used to change the current directory.
Linux File commands
- touch is used to create empty files. We can create multiple empty files by executing it once.
- cat is a multi-purpose utility in the Linux system. It can be used to create a file, display content of the file, copy the content of one file to another file.
- rm is used to remove a file.
- mv is used to move a file or a directory from one location to another location.
- cp is used to copy a file or directory.
- rename is used to rename files. It is useful for renaming a large group of files.
Linux File Content Commands
- head is used to display the content of a file. It displays the first 10 lines of a file.
- tail is similar to the head command. The difference between both commands is that it displays the last ten lines of the file content. It is useful for reading the error message.
- tac is the reverse of cat command, as its name specified. It displays the file content in reverse order (from the last line).
- more is quite similar to the cat command, as it is used to display the file content in the same way that the cat command does. The only difference between both commands is that, in case of larger files, the more command displays screenful output at a time.
- less is similar to the more command. It also includes some extra features such as ‘adjustment in width and height of the terminal.’ Comparatively, the more command cuts the output in the width of the terminal.
Linux User Commands
- su provides administrative access to another user
- id command is used to display the user ID (UID) and group ID (GID).
- useradd is used to add user on a Linux server.
- passwd is used to create and change the password for a user.
Linux Filter Commands
- cat is also used as a filter
- cut is used to select a specific column of a file.
- grep is the most powerful and used filter in a Linux system. The ‘grep’ stands for “global regular expression print.” It is useful for searching the content from a file. Generally, it is used with the pipe.
- wc is used to count the lines, words, and characters in a file.
- sort is used to sort files in alphabetical order.
Linux Utility Commands
- find is used to find a particular file within a directory. It also supports various options to find a file such as by name, by type, by date.
- locate is used to search a file by file name in the background.
- date is used to display date, time, time zone, and more.
- df is used to display the disk space used in the file system
- mount is used to connect an external device file system to the system’s file system.
- exit is used to exit from the current shell.
- clear is used to clear the terminal screen.
Linux Networking Commands
- ip is used to assign an IP address, initialize an interface, disable an interface.
- ssh is used to create a remote connection through the ssh protocol.
- ping is used to check the connectivity between two nodes, that is whether the server is connected.
- host is used to display the IP address for a given domain name. It performs the DNS lookups for the DNS Query.
- wget is used to download files from a different repository
Process management commands
- ps is used to display active processes
- kill is used to terminate a process
- killall is used to terminate all running processes
Conclusion
From the above we have seen various commands to assist us in daily work on a Linux system.
Check this articles for further reading