Skip to content

Advanced commands

CiamalaKombeGreg edited this page Oct 5, 2023 · 8 revisions

Advanced commands of linux shell

You can find example of more complex commands here, mostly mix of basic ones.

The command whatis is a brief version of man, giving you the basic understanding of what a command does.

Sort

Well, the command sort sort lines of a file. You can use the option -r to sort it in reverse. The command can be write sort <file>.

touch test.txt # > 5 lines with the follow up lines : bedroom, apple, customer, uranium, gorilla.
sort test.txt # > display as apple - bedroom - customer - gorilla - uranium

who

It show all users connected to the system. You can just type who in the shell.

adduser

It create a new user or edit a former one. You can type it adduser <pseudo>.

useradd Halima

groupadd

it create a new group or edit a former one. You can type it groupadd <group name>.

groupadd 6te

chgrp

This command change the file ownership to a group. You can type it as chgrp <group> <file>.

chgrp 6te test.txt

umask

The command umask change permissions attributed to a file when creating it. It is a 0000 in general. You can display it by typing umask.

umask #Display a 0000 umask
umask 0002 #Now it's 0002

The permission of a file is determined by read = 4, write = 2 and execute = 1. Each type of users have a defined permissions from 0 to 7, if a permissions is set to 6 for example, then you while only have access to read and write because 4 + 2 = 6. The position of the 0 in the umask correspond to a type of user.

Clone this wiki locally