Shell & Commandes UNIX - Chapitre 2
48 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Quels fichiers contiennent les comptes utilisateurs locaux sur un système UNIX?

  • /etc/users, /etc/acct, /etc/group
  • /etc/passwd, /etc/shadow, /etc/group (correct)
  • /etc/passwd, /etc/login, /etc/group
  • /etc/passwd, /etc/passwd.d, /etc/group

Quelle commande permet d'afficher les variables d'environnement dans un terminal UNIX?

  • env (correct)
  • listenv
  • showenv
  • displayenv

Quelle commande fournit une courte description des pages de manuel sur UNIX?

  • help
  • apropos (correct)
  • info
  • man

Quelle est la forme correcte d'une variable d'environnement?

<p>nom=valeur (C)</p> Signup and view all the answers

Quel ensemble de mots réservés est utilisé pour les structures de contrôle de flux dans un script shell?

<p>if, while, for, else (D)</p> Signup and view all the answers

Quelle commande interne permet d'afficher des résumés de commandes intégrées dans le shell?

<p>help (C)</p> Signup and view all the answers

Pourquoi les commandes internes n'entraînent-elles pas la création d'un processus dans le shell?

<p>Elles sont réalisées en interne par le shell (C)</p> Signup and view all the answers

Quelle commande permet de vérifier qui est connecté sur un système UNIX?

<p>who (B)</p> Signup and view all the answers

Que fait l'opérateur & lorsqu'il est placé à la fin d'une commande ?

<p>Il exécute la commande en arrière plan. (A)</p> Signup and view all the answers

Comment peut-on visualiser tous les fichiers, y compris les fichiers cachés, dans un répertoire ?

<p>En utilisant la commande ls -a. (B)</p> Signup and view all the answers

Quel est le symbole qui représente le répertoire racine dans un système UNIX ?

<p>/ (B)</p> Signup and view all the answers

Quel est le rôle des caractères . (point) et .. (deux points) dans la manipulation des répertoires ?

<p>. indique le répertoire courant et .. indique le répertoire parent. (C)</p> Signup and view all the answers

Que permet la commande ls -l lorsque vous l'exécutez ?

<p>Elle affiche des détails supplémentaires sur les fichiers. (C)</p> Signup and view all the answers

Quel caractère est utilisé pour séparer les noms des répertoires dans UNIX et Linux ?

<p>/ (C)</p> Signup and view all the answers

Quelle commande peut être utilisée pour afficher le contenu d'un répertoire lorsque aucun argument n'est fourni ?

<p>ls (B)</p> Signup and view all the answers

Quel répertoire contient les répertoires personnels des utilisateurs ?

<p>/home (C)</p> Signup and view all the answers

Quel est le rôle du symbole ~ (tilde) dans un système UNIX ?

<p>Il indique le répertoire de l'utilisateur courant. (C)</p> Signup and view all the answers

Quel type de chemin est défini à partir de la racine du système de fichiers ?

<p>Chemin absolu (B)</p> Signup and view all the answers

Quels éléments identifient un utilisateur sous UNIX ?

<p>Nom, UID et GID (B)</p> Signup and view all the answers

Quel répertoire contient les outils systèmes pour l'administration ?

<p>/sbin (C)</p> Signup and view all the answers

Quelle commande pourrait être utilisée pour accéder au répertoire parent dans le système de fichiers ?

<p>.. (B)</p> Signup and view all the answers

Quelle affirmation décrit le mieux le néologisme '$HOME' ?

<p>Le répertoire personnel de l'utilisateur courant (D)</p> Signup and view all the answers

Quel répertoire est associé aux applications et commandes pour les utilisateurs ?

<p>/usr (B)</p> Signup and view all the answers

Quel est le rôle du chemin d'accès (PATH) dans un système de fichiers ?

<p>Permettre d'atteindre un fichier dans le système de fichiers (C)</p> Signup and view all the answers

Quelle commande est utilisée pour supprimer des fichiers dans le shell UNIX?

<p>rm (C)</p> Signup and view all the answers

Qu'est-ce que l'option '-i' fait dans les commandes UNIX?

<p>Demande une confirmation avant de supprimer un fichier (D)</p> Signup and view all the answers

Que fait la commande 'cp' avec l'option '-R'?

<p>Copie récursivement les répertoires (D)</p> Signup and view all the answers

Quelle commande permet de déplacer ou renommer des fichiers?

<p>mv (D)</p> Signup and view all the answers

Si le dernier argument d'une commande 'cp' est un répertoire, que se passe-t-il?

<p>Les fichiers sont copiés dans ce répertoire (A)</p> Signup and view all the answers

Quel est le résultat de la commande 'rm -f /tmp/*'?

<p>Supprime tous les fichiers dans le répertoire /tmp (A)</p> Signup and view all the answers

Que se passe-t-il si vous exécutez 'mv' sans options supplémentaires et avec deux fichiers différents?

<p>Le premier fichier remplace le second (B)</p> Signup and view all the answers

Quel effet a l'option '-f' dans une commande UNIX?

<p>Elle force l'opération sans confirmation (D)</p> Signup and view all the answers

Quel est le but de la commande 'cd' dans un shell?

<p>Changer le répertoire courant (A)</p> Signup and view all the answers

Quelles options sont couramment utilisées avec la commande 'mkdir'?

<p>-p pour créer les répertoires parents manquants (C)</p> Signup and view all the answers

Quel est l'effet de la commande 'rmdir'?

<p>Supprimer des répertoires uniquement s'ils sont vides (B)</p> Signup and view all the answers

Quelle commande serait utilisée pour créer un répertoire nommé 'NouveauDossier' dans le répertoire courant?

<p>$ mkdir NouveauDossier (C)</p> Signup and view all the answers

Quel est le rôle de la commande 'ls -l' dans UNIX ?

<p>Afficher les permissions des fichiers (A)</p> Signup and view all the answers

Comment pouvez-vous aller à la racine de l'arborescence du système avec une commande shell?

<p>$ cd / (B)</p> Signup and view all the answers

Quel symbole représente un répertoire lorsqu'on utilise la commande 'ls -l' ?

<p>d (A)</p> Signup and view all the answers

Si vous voulez créer plusieurs répertoires en une seule commande, quelle syntaxe utiliseriez-vous?

<p>$ mkdir dossier1 dossier2 (A)</p> Signup and view all the answers

Quel type d'accès est représenté par la lettre 'w' ?

<p>Accès en écriture (D)</p> Signup and view all the answers

Que se passe-t-il si vous essayez de supprimer un répertoire avec 'rmdir' qui contient des fichiers?

<p>La commande échoue et laisse le répertoire intact (B)</p> Signup and view all the answers

Que signifie la commande 'chmod g+rx ./myprogram' ?

<p>Ajouter les droits de lecture et d'exécution au groupe (C)</p> Signup and view all the answers

Quel est l'ordre de la commande pour aller au dossier 'Dossier2' qui se trouve dans 'Dossier1' dans le dossier 'Desktop'?

<p>$ cd ~/Desktop/Dossier1/Dossier2 (D)</p> Signup and view all the answers

Quel caractère est utilisé pour spécifier 'les autres' dans les permissions UNIX ?

<p>o (A)</p> Signup and view all the answers

Quelle commande permet de retirer tous les droits d'exécution sur un fichier ?

<p>chmod a-x ./fichier (D)</p> Signup and view all the answers

Quelle combinaison de lettres ne correspond pas à un type de permission UNIX ?

<p>z (D)</p> Signup and view all the answers

Que fait la commande 'chmod u=rwx ./myprogram' ?

<p>Change les droits de l'utilisateur à lecture, écriture et exécution (A)</p> Signup and view all the answers

Flashcards

User Accounts (UNIX)

User accounts are defined in files like /etc/passwd, /etc/shadow, and /etc/group.

User Information Commands

Commands like id, whoami, who, w, last, and users display user-related information.

Shell Commands

Commands that control the shell environment and manage files and directories.

Manpage Commands

man, apropos, whatis, help provide help and documentation for shell commands.

Signup and view all the flashcards

Execution Environment

The current state of a system defined by environment variables, accessible to running programs.

Signup and view all the flashcards

Environment Variables

Variables that affect how programs run, including values like USER or HOME.

Signup and view all the flashcards

Shell Built-in Commands

Commands that run directly within the shell itself, not requiring separate processes.

Signup and view all the flashcards

Shell Keywords

Reserved words like case, for, if, while that have special meanings in shell scripting.

Signup and view all the flashcards

Background execution

Executing a command in the background, allowing the user to run other commands simultaneously.

Signup and view all the flashcards

Command execution symbol

An operator used to run a command in the background.

Signup and view all the flashcards

Directory names

Represent different directories, separated by the '/' (slash) character in Unix/Linux systems.

Signup and view all the flashcards

Current directory

The directory where the user is currently working.

Signup and view all the flashcards

Parent directory

The directory above the current directory in the file system hierarchy.

Signup and view all the flashcards

Root directory

The top-level directory in a file system.

Signup and view all the flashcards

Home directory

The user's personal directory.

Signup and view all the flashcards

ls command

A command used to list the contents of a directory.

Signup and view all the flashcards

Change Directory

The command cd changes the current working directory.

Signup and view all the flashcards

cd command syntax

$ cd <directory>

Signup and view all the flashcards

Create Directory

The mkdir command creates new directories.

Signup and view all the flashcards

mkdir with subdirectories

mkdir -p <directory_path> Option (-p) creates parent directories if necessary.

Signup and view all the flashcards

Remove Directory

The command rmdir removes empty directories.

Signup and view all the flashcards

rmdir Syntax

rmdir <directory_name>

Signup and view all the flashcards

Directory Structure

The hierarchical arrangement of files and folders in a file system.

Signup and view all the flashcards

Working Directory

The current directory that commands operate within.

Signup and view all the flashcards

rm command

Removes files. Uses rm [options] files syntax. Doesn't remove directories by default, but can with the -r option.

Signup and view all the flashcards

rm -f

Forces the removal of files, skipping any confirmation prompts.

Signup and view all the flashcards

rm -r

Recursive removal (removes directories and their contents).

Signup and view all the flashcards

cp command

Copies files or directories using cp [options] files... destination syntax.

Signup and view all the flashcards

cp -R

Copies directories recursively. This copies the entire folder structure.

Signup and view all the flashcards

cp -i

Copies files interactively. Prompts before overwriting existing files.

Signup and view all the flashcards

mv command

Moves or renames files. mv [options] files... destination.

Signup and view all the flashcards

mv -i

Moves interactively. Prompts before overwriting an existing file.

Signup and view all the flashcards

Unix File Permissions

A security system in Unix that controls what users can do with files and directories.

Signup and view all the flashcards

ls -l command

Lists file permissions in Unix, showing who can read, write, or execute a file.

Signup and view all the flashcards

File permissions

Instructions that decide what user actions are allowed for a file or directory.

Signup and view all the flashcards

chmod command

Changes file permissions in Unix.

Signup and view all the flashcards

rwx permissions

Read (r), Write (w), Execute (x) permissions assigned for users in Unix

Signup and view all the flashcards

read (r) permission

The right to view the contents of a file or execute a program.

Signup and view all the flashcards

write (w) permission

The right to modify the contents of a file.

Signup and view all the flashcards

execute (x) permission

The right to run a file as a program.

Signup and view all the flashcards

File System Hierarchy

The organizational structure of files and directories in a computer system, like a tree with the root at the top.

Signup and view all the flashcards

Absolute Path

A file's location starting from the root directory (/) of the file system.

Signup and view all the flashcards

Relative Path

A file's location starting from the current working directory.

Signup and view all the flashcards

Home Directory

The user's personal directory.

Signup and view all the flashcards

Root Directory

Top-level directory in a file system.

Signup and view all the flashcards

Current Directory

The directory you are currently working in.

Signup and view all the flashcards

Parent Directory

Directory above the current directory (one level up).

Signup and view all the flashcards

User ID (UID)

A unique numerical identifier for a user on a Unix-like system.

Signup and view all the flashcards

Study Notes

Shell & Commandes UNIX - Chapitre 2

  • Shell: A command-line interface for interacting with the UNIX operating system
  • Objectives of a Shell:
    • Provide a command input interface
    • Redirect standard input/output
    • Analyze commands (including file name substitution, variable substitution, and redirection)
    • Execute commands (synchronously and asynchronously)
    • Provide an interpreted language
  • Shell Types:
    • Bourne Shell (sh): A commonly used shell for scripting.
    • C Shell (csh): Developed by BSD, similar syntax to C language.
    • Korn Shell (ksh): Extension of Bourne Shell, developed by AT&T.
    • Bourne Again Shell (bash): An improved version of sh and csh, often the default shell for Ubuntu Linux.
    • Zero Shell (zsh): Highly functional shell with advanced features like typing, substitution, and completion.
    • Tenex Shell (tcsh): Extension of csh.
    • Commonly used for system administration:/bin/sh.
  • Modes of Shell Usage:
    • Interactive: The shell presents a prompt, waits for the user to input a command, then executes it.
      • Standard prompts: $ for user, % for user in csh/tcsh, # for root.
      • Executes the command entered by the user.
      • Returns to the interactive mode
    • Non-Interactive (Scripting/Batch): A script file containing multiple commands is processed. -Reads a line from the script. -Executes the commands on that line. -Moves to the next line in the script. -Stops when there are no more lines to process or a special command like exit or return is encountered.
  • Special Characters: Provides various functionalities in shell commands.
    • \t : Tabulation : Space / : New line, Return character & : Background process ;; ; Separators * ? [] [^] : File name substitution. && || ! : Boolean operators "" '' : Quotation characters < and > : Redirection of input/output. << >> : Redirection operators | : Pipe - connecting outputs of one command to the input of another $ : Variable value # : Start of comment
  • Linux File System Tree: Hierarchical structure with a root directory (/). The tree structure shows different parts of the Linux system.
    • /etc: System configuration files.
    • /dev: Special files for device access (e.g., hardware).
    • /bin: Basic system commands.
    • /sbin: System administration commands.
    • /usr: User commands and applications (including GUI environments).
    • /home: User home directories.
  • Path Concepts: Used for locating files and directories within the file system.
    • Relative Paths: Starting from the current directory.
      • . (current directory)
      • .. (parent directory)
      • $HOME (user's home directory)
    • Absolute Paths: Starting from the root directory (/).
  • Users and Accounts: Information and access control for users in UNIX-based systems.
    • System users are individually identified by their name
    • The UID and GID
  • Helpful Commands:
    • man: Provides manual pages
    • apropos: Search manual pages
    • whatis: Displays short descriptions of commands..
    • help [command] (integrated shell): Brief summaries of in-built commands.
    • --help: Displays help for a specific command
    • info [command] (more detailed help).
  • Execution Environment: Sets the conditions under which commands run within the shell.
    • A particular state of the system defined by the values of environment variables.
    • Processes access these variables during their execution.
    • Variables are in pairs name=value.
  • Reserved Keywords:
    • Control structures for shell scripts. Example: if, then, elif, else, fi, while, until, case, in, esac, for, do, done, break, continue, return, exit, etc.
  • Internal/Built-in Commands:
    • Executed directly by the shell itself without creating a new process.
  • Command Execution:
    • Command name, parameters (separated by spaces), options (starting with a hyphen)
  • Chaining Commands:
    • Enables multiple commands to be executed sequentially on a single line, separated by semicolons.
  • Background Processes: Running a command in the background (using & at the end).
  • Directory Manipulation:
    • /bin/ls: Lists files and directories in a directory.
    • cd [directory]: Changes the current directory.
    • mkdir [directory]: Creates a new directory.
    • rmdir [directory]: Removes an empty directory.
  • File Manipulation:
    • rm [file]: Removes a file (or more).
    • cp [source] [destination]: Copies files.
    • mv [source] [destination]: Moves or renames files.
  • **Access Control:**Controlling access to files and directories, using ls -l (list long format) for detailed permissions and chmod for modifying them
    • chmod [mode] [file]: Modifies file permissions (using symbolic representation or numerical values).

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Description

Ce quiz porte sur le Chapitre 2 concernant les shells et commandes UNIX. Il aborde les objectifs des shells, différents types de shells et leurs caractéristiques. Testez vos connaissances sur l'interface de ligne de commande et l'exécution des commandes sous UNIX.

More Like This

UNIX BASH Grundlagen
13 questions

UNIX BASH Grundlagen

RevolutionaryFern2779 avatar
RevolutionaryFern2779
Shell et Commandes UNIX - Chapitre 2
8 questions
Use Quizgecko on...
Browser
Browser