Module 3 - 04-1 Flashcards
Navigate the Linux file system
Define Bash
The default shell in most Linux distributions
Define Command
An instruction telling the computer to do something
A command in Bash:
What does “a dollar sign before the cursor” mean
This is your prompt to enter a new command
~$ (blinking square)
Define Argument
Specific information needed by a command
What is one thing that is really important in Linux?
All commands and arguments are case sensitive
What is a Linux command?
- A dollar sign ($) before the cursor
- The information that is output from the shell
- An instruction telling the computer to do something
- The default shell in most Linux distributions
A Linux command is an instruction telling the computer to do something.
What does FHS stand for?
Filesystem Hierarchy Standard (FHS)
Define FHS
The component of the Linux OS that organizes data.
This file system is a very important part of Linux because everything we do in Linux is considered a file somewhere in the system’s directory.
It defines how directories, directory contents, and other storage is organized in the operating system.
The FHS is a hierarchical system, and just like with a tree, everything grows and branches out from the root.
Define Root Directory
The highest-level directory in Linux
All subdirectories branch off the root directory. Subdirectories can continue branching out to as many levels as necessary.
How is the Root Directory designated in Linux?
It is designated by a single forward slash ( / )
How are forward slashes (/) used when describing the directory structure in Linux?
Forward slashes are used when tracing back through these branches to the root.
What does the Linux command “ pwd “ stand for?
Print Working Directory
What are Key commands for navigating the file system in Linux?
The following Linux commands can be used to navigate the file system:
- pwd
- ls
- cd
What does the command “ pwd “ display when executed?
It displays the current working directory (the directory you are currently in) in the terminal
This command is useful for confirming your location within the filesystem.
The output gives you the absolute path to this directory.
For example, if you’re in your home directory and your username is analyst, entering pwd returns /home/analyst.
What does the command “ whoami “ display when executed?
To learn what your username is, use the whoami command.
The whoami command returns the username of the current user.
For example, if your username is analyst, entering whoami returns analyst.
It’s useful when you want to quickly check which user is currently logged in, especially if you’re managing multiple user accounts or switching between users in a terminal session.
The whoami command returns the username of the current user who is executing the command, providing a simple way to identify the active user.
What does the Linux command “ ls “ stand for?
List
What does the command “ ls “ display when executed?
It displays the names of files and directories in the current directory.
The ls command is highly versatile, and you can combine various flags to control the output in many ways.
If you want to return the contents of a directory that’s not your current working directory, you can add an argument after ls with the absolute or relative file path to the desired directory.
For example, if you’re in the /home/analyst directory but want to list the contents of its projects subdirectory, you can enter ls /home/analyst/projects or just ls projects.
What does the Linux command “ cd “ stand for?
Change Directory
What does the command “ cd “ display when executed?
It is used to navigate between directories in the filesystem.
To navigate to a subdirectory of the current directory, you can add an argument after cd with the subdirectory name.
For example, if you’re in the /home/analyst directory and want to navigate to its projects subdirectory, you can enter cd projects.
You can also navigate to any specific directory by entering the absolute file path. For example, if you’re in /home/analyst/projects, entering cd /home/analyst/logs changes your current directory to /home/analyst/logs.
Pro Tip: You can use the relative file path and enter cd .. to go up one level in the file structure. For example, if the current directory is /home/analyst/projects, entering cd .. would change your working directory to /home/analyst.
What are Common commands for reading file content in Linux?
The following Linux commands are useful for reading file content:
* cat
* head
* tail
* less
What does the Linux command “ cat “ stand for?
Concatenate
What does the command “ cat “ display when executed?
It is used to display the contents of a file on the terminal.
It can also be used to concatenate (combine) multiple files.
So, cat is a versatile command that can be used for displaying, combining, and manipulating the contents of files.
To display the contents of a file using the “ cat “ command in Linux, what would the format be?
To display the contents of a file using the “ cat “ command in Linux, the format is as follows:
” cat filename.txt “
Example:
If you want to display the contents of a file named “ example.txt “, you would run:
” cat example.txt “
This will output the entire contents of example.txt to the terminal.
What does the Linux command “ head “ stand for?
Head of a file