Curiosité, apprentissage et soutien scolaire
22/10/2024
InscriptionConnexion
Langue : FR | ENG

NEWSLETTER

:

Venez discuter sur le forum !
 Inscription RAPIDE et GRATUITE. 
😀 Accès aux forums de discussion 😀
SOUTIEN SCOLAIRE, aide en INFORMATIQUE, aide pour apprendre le FRANÇAIS et l'ANGLAIS, discussion sur vos centres d'INTÉRÊTS et LOISIRS...

Vous recherchez la version française de cette section ?

Cette section est en anglais parce que les contenus sont en anglais. Si vous préférez la version française de cette section, cliquez sur le lien ci-dessous.
Cependant, les contenus des sections française et anglaise ne sont pas nécessairement les mêmes !
Contenus sur l'informatique en français


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 version of Linux:
  • cat /etc/issue

  • See the name of the current user:
  • whoami

  • See the name of the machine:
  • hostname

  • See who is logged in and what they are doing:
  • w

  • Find a file:
  • find . -name file_name -print

  • Find a directory:
  • find . -name directory_name -d -print

  • Search a string of characters in a file or a directory (by default, the current directory):
  • grep -rni string [file_or_directory]

    r : recursive
    n : display the number of the line in the file
    i : ignore case

  • Display the information of all files:
  • ls -lah

    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:
  • du -sh *

    s : do not display the sub-directories
    h : display the sizes in a human-readable format

  • Display disk usage statistics:
  • df -h

  • Unzip in another directory:
  • tar zxvf archive.tar.gz -C /target_folder/

  • Show the last 5 lines of a file:
  • head file.txt

  • File rights:
  • 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:
    Xrwx
    0000
    1001
    2010
    3011
    4100
    5101
    6110
    7111

  • Take back control in a terminal: do CTRL-Z then type 'bg'.

  • Launch a process by making it independent of the terminal:
  • nohup the_process &

  • Detach a process from the terminal:
  • disown pid_process

    where pid_process is the PID of the process given by the command ps.

  • Launch several commands in only one line:

    • without taking into account the result of the previous command:
    • command1 ; command2

    • if the previous commands has been completed successfully:
    • command1 && command2

    • if the previous command is not working properly:
    • command1 || command2

  • Locate an executable:
  • which executable_name

  • Load and run a shell script:
  • source file.sh

  • Planning of scheduled tasks:
  • 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

  • Read a file being written:
  • tail -f file

  • Tip for displaying in columns all directories in environment variables ($PATH, $PYTHONPATH, ...) :
  • echo $PATH | tr ':' '\n'

  • List the librairies required by an executable:
  • ldd executable_name

  • Launch Firefox with another profile:
  • firefox -P

  • Extract all pages from a pdf with the tool pdfseparate:
  • pdfseparate in.pdf out%d.pdf

  • Extract the pages I to J of a pdf with the tool pdfseparate:
  • pdfseparate -f I -l J in.pdf out%d.pdf

  • Merge several pdf files with the tool pdfunite:
  • 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.
Partager cette page sur les réseaux sociaux :
Des questions, des commentaires ?
Commentaires rapides
Il n'y a pas encore de commentaires.

Utilisation des cookies sur ce site web :
- Si vous n'êtes pas inscrit à ce site, aucun cookie n'est stocké intentionnellement sur votre ordinateur.
- Si vous êtes inscrit à ce site, les cookies sont utilisés uniquement pour conserver votre connexion après chaque visite. Cette option est désactivable à volonté dans votre profil et est désactivée par défaut.
- Aucune autre information n'est stockée ou récupérée à votre insu, ni vos informations personnelles ni aucune autre quelle qu'elle soit. En cas de doute, n'hésitez pas à contacter l'administrateur de ce site .
- Même ce bandeau d'information n'utilise pas de cookies et donc sera affiché constamment à chaque visite sur toutes les pages du site.