Published on

Linux Utility Commands

Authors

Display the contents of a folder on a page, sorted ascending by last modification date.

ls -ltr

Display the last command run

Esc + k

Search for text in a file

cat filename | grep text

Display the end of the file while reading

tail -f filename

Count the number of folders in a directory

ls -l | grep ^d | wc -l

Find all files in a folder

find folder -type f

Display the first n lines of a file

head -nb_ligne filename

Change the ownership of a folder to root

chown new_user /folder

Change the ownership and group of a folder to root

chown new_user:new_group /folder

Change the ownership of a folder and its subfolders to root

chown -hR new_user /folder

Show running processes

ps -ef|grep java|wc -l