Linux Regular Use Command
Linux Regular Use Command
Linux Regular Use Command
Syntax:
history
24.ls command
The ‘ls’ is the most basic and probably one of the first commands anyone learns.
It is a simple command to list the directory of files and directories. The ls
command will list files in the active directory if the user does not specify other. It
is one of the most frequently used commands as users can concatenate its
various options.
Syntax:
ls
The above command will list all files in the current directory. For a
comprehensive list, coders have to use the -l(long) option and use the -
h(human) option to ensure the file sizes are mentioned in a human-readable
format.
ls –lh
In case, a user also wants to view hidden files, then enter -a (all files) parameter:
ls –lha
To modify the list in order of latest updates, enter the following command:
ls -lt
25.shutdown command
The shutdown command is simple as it sounds and most users will come across as
soon as they learn about Linux commands. As the name sounds, the shutdown
command will switch off or shut down your Linux system.
There are various parameters you can use with the shutdown command, but if no
parameter is specified, then the computer will shut down in one minute.
Syntax:
shutdown
In case you are in a rush and wants to shut down the computer immediately, then use
the ‘now
shutdown now
Users can even schedule shutdown and also notify all users for the same with a single
command. The only thing users are to provide is the time and the pc will shutdown as
per scheduled. You can also schedule in minutes, such as 10 minutes from now. Below
are both examples:
shutdown tonight at 22:00, don’t forget to save your work and enjoy the
weekend!
shutdown +10
Use the -c(cancel) option to cancel the scheduled shutdown.
shutdown -c
26.passwd command
With the passwd command, users can change the password for a user.
It not only lets you change your password but also of other users. The
passwd command is also one of the most frequently used Linux
commands. The command comes in very handy as it makes it very easy
to change the password for anyone in the team. To change others
password, users have to use sudo command as it requires permission
privileges. Type passwd to change your own password
Syntax:
passwd
To change others password, type the following:
sudo passwd max
27. chmod command
The chmod command allows users to alter or assign file permissions flags on a file
or folder. The permission defines who can read, write, or run the file. The code
comes with references, which indicates to whom the permission will be applicable.
Specific letters represent the references, and programmers can use these letters to
assign permission. Below is the list of letters:
u - the owner of the file
g - this represents a group. So when assigned, it will apply to all members of
the file’s group.
o - users who are not the owner or a group member
a - those who are all of the above
Then comes the ‘modes’ that represent each of the permission types. The
following are the permissions that a user can assign for a file:
r - the letter means the user has the permission to the only read
w - the letter corresponds to write or delete the file
x - the mode allows users to execute a file
Users can view permissions of all files using the -l command. It will list file in the
current directory. It will result in a string of characters as follows:
So, one can use chmod to give change or assign permission to either an
owner, group, or others. More so, the string of characters is followed
by digits which represent the specific type of file permission.
0: No permission is assigned
1: Execute permission
2: it has to write permission
3: the user has write and execute permissions
4: users can only read with this permission
5: users have read and permission to execute
6: it indicates that you have both read and write permissions
7: it offers you to do anything with the file such as read, write and
execute