| Come to discuss on the forum! ■ FAST and FREE signup. ■ | 
| 😀 Access to discussion forums 😀 | 
| Help for HOMEWORKS, support in COMPUTER SCIENCE, help for learning FRENCH and ENGLISH, discussion on your INTERESTS and HOBBIES... | 
Some useful commands
	
		Here is a list of commands that can be useful to have on hand when working on a UNIX system:
 See the name of the current user: 
 See the name of the machine: 
 See who is logged in and what they are doing: 
 Find a file: 
 Find a directory: 
 Search a string of characters in a file or a directory (by default, the current directory): 
r : recursive
n : display the number of the line in the file
i : ignore case
 Display the information of all files: 
l : diplay the information
a : include hidden files and directories
h : display the sizes in a human-readable format
 Display the sizes of the folders: 
s : do not display the sub-directories
h : display the sizes in a human-readable format
 Display disk usage statistics: 
 Unzip in another directory: 
 Show the last 5 lines of a file: 
 File rights: 
The first X corresponds to the rights of the file owner.
The second X corresponds to the rights of the users in the file group.
The third X corresponds to the rights of all users.
Values of XXX:
 Take back control in a terminal: do CTRL-Z then type 'bg'. 
 Launch a process by making it independent of the terminal: 
 Detach a process from the terminal: 
where pid_process is the PID of the process given by the command ps.
 Launch several commands in only one line: 
 if the previous commands has been completed successfully: 
 if the previous command is not working properly: 
 Locate an executable: 
 Load and run a shell script: 
 Planning of scheduled tasks: 
Format of the crontab file:
m : minutes (0-59)
h : hours (0-23)
d : day of the month (1-31, *: all days)
month : month (1-12, *: all months)
dow : day of the week (0-6, 0: sunday)
command : command to run
 Read a file being written: 
 Tip for displaying in columns all directories in environment variables ($PATH, $PYTHONPATH, ...) : 
 List the librairies required by an executable: 
 Launch Firefox with another profile: 
 Extract all pages from a pdf with the tool pdfseparate: 
 Extract the pages I to J of a pdf with the tool pdfseparate: 
 Merge several pdf files with the tool pdfunite: 
If you have any questions about these commands or if you know other useful commands, you can discuss them in the forum: Discussion forums.
	- See the version of Linux:
cat /etc/issue
whoami
hostname
w
find . -name file_name -print
find . -name directory_name -d -print
grep -rni string [file_or_directory]
r : recursive
n : display the number of the line in the file
i : ignore case
ls -lah
l : diplay the information
a : include hidden files and directories
h : display the sizes in a human-readable format
du -sh *
s : do not display the sub-directories
h : display the sizes in a human-readable format
df -h
tar zxvf archive.tar.gz -C /target_folder/
head file.txt
chmod [-R] XXX file_name
The first X corresponds to the rights of the file owner.
The second X corresponds to the rights of the users in the file group.
The third X corresponds to the rights of all users.
Values of XXX:
| X | rwx | 
| 0 | 000 | 
| 1 | 001 | 
| 2 | 010 | 
| 3 | 011 | 
| 4 | 100 | 
| 5 | 101 | 
| 6 | 110 | 
| 7 | 111 | 
nohup the_process &
disown pid_process
where pid_process is the PID of the process given by the command ps.
- without taking into account the result of the previous command:
command1 ; command2
command1 && command2
command1 || command2
which executable_name
source file.sh
crontab -l (read the file)
crontab -e (edit the file)
Format of the crontab file:
m h d month dow commande
m : minutes (0-59)
h : hours (0-23)
d : day of the month (1-31, *: all days)
month : month (1-12, *: all months)
dow : day of the week (0-6, 0: sunday)
command : command to run
tail -f file
echo $PATH | tr ':' '\n'
ldd executable_name
firefox -P
pdfseparate in.pdf out%d.pdf
pdfseparate -f I -l J in.pdf out%d.pdf
pdfunite pdf1.pdf pdf2.pdf pdf3.pdf out.pdf
If you have any questions about these commands or if you know other useful commands, you can discuss them in the forum: Discussion forums.
		Share this page on social media:
		
		           
		
		
		
		Questions, comments?
	
Quick comments
		
	
			There is no comment yet.
		
		

