GX2 Finding Your Way on a Linux System Flashcards
Topic 2.1: Command Line Basics
What is Bash?
Bash (Bourne Again Shell) is a command-line interpreter that allows users to interact with the Linux operating system.
Topic 2.1: Command Line Basics
What does the echo command do?
The echo command prints text or variables to the terminal. Example: echo “Hello, Linux!”
Topic 2.1: Command Line Basics
How can you view previously entered commands in the terminal?
Use the history command to display a list of previously executed commands.
Topic 2.1: Command Line Basics
What is the purpose of the PATH environment variable?
The PATH variable defines directories where the system looks for executable programs.
Topic 2.1: Command Line Basics
How do you set or modify an environment variable?
Use the export command. Example: export MYVAR=”Hello”
Topic 2.1: Command Line Basics
How do you check the type of a command or utility?
Use the type command. Example: type ls tells you if ls is a built-in or external command.
Topic 2.2: Using the Command Line to Get Help
How do you access the manual (man) page for a command?
Use the man command followed by the command name. Example: man ls
Topic 2.2: Using the Command Line to Get Help
What is the difference between man and info pages?
man pages provide concise documentation, while info pages offer more detailed, structured documentation.
Topic 2.2: Using the Command Line to Get Help
Where can you find additional documentation on installed programs?
In the /usr/share/doc/ directory.
Topic 2.2: Using the Command Line to Get Help
How do you locate a file or command on the system?
Use the locate command. Example: locate bashrc
Topic 2.3: Using Directories and Listing Files
How do you list files in a directory?
Use the ls command. Example: ls -l for a detailed list.
Topic 2.3: Using Directories and Listing Files
How do you show hidden files in a directory?
Use ls -a. Hidden files start with a dot (.).
Topic 2.3: Using Directories and Listing Files
What is the difference between absolute and relative paths?
Absolute path: Full path from root (e.g., /home/user/file.txt).
Relative path: Path from the current directory (e.g., ../file.txt).
Topic 2.3: Using Directories and Listing Files
What do . and .. represent in a directory?
. represents the current directory.
.. represents the parent directory.
Topic 2.3: Using Directories and Listing Files
What does cd ~ do?
It navigates to the home directory of the current user.
Topic 2.4: Creating, Moving, and Deleting Files
How do you create an empty file?
Use the touch command. Example: touch myfile.txt
Topic 2.4: Creating, Moving, and Deleting Files
How do you move or rename a file?
Use the mv command. Example: mv oldname.txt newname.txt
Topic 2.4: Creating, Moving, and Deleting Files
How do you copy a file?
Use the cp command. Example: cp file.txt backup.txt
Topic 2.4: Creating, Moving, and Deleting Files
How do you delete a file?
Use the rm command. Example: rm myfile.txt
Topic 2.4: Creating, Moving, and Deleting Files
How do you create and remove directories?
Create: mkdir mydir
Remove: rmdir mydir (only works if empty)