Navigating the Linux Terminal: Key Prompts, Directory Structure, and Commands for Beginners
When using a Linux terminal, the command prompt provides essential information that helps users understand their current environment. Let's break down the components of a typical terminal prompt and the hierarchical structure of Linux directories.
The Terminal Prompt
The prompt often includes:
Username: Shows the user executing commands.
Hostname: Indicates the machine being used.
Special Symbols:
@: Separates the username from the hostname.
: or ~: Follows the hostname, indicating the current directory.
$ or #: Denotes user type:
$
for a regular user,#
for the root user.
Example Prompt:
username@hostname:~$
username: Current user.
hostname: Machine name.
~: Home directory (changes to the actual path if in another directory).
$: Regular user (changes to
#
for root).
The Linux Directory Structure
Linux organizes files in a hierarchical structure, starting from the root directory (/
). Here’s an overview of common directories:
/bin
: Essential binaries./boot
: Boot loader files and kernel./dev
: Device files (e.g.,/dev/sda
)./etc
: Configuration files and scripts./home
: User home directories (e.g.,/home/username
)./lib
: Shared libraries./media
: Mount point for removable media./mnt
: Temporary mount point for filesystems./opt
: Optional and third-party software./proc
: Virtual files for system and process information./root
: Root user’s home directory./sbin
: System binaries for administration./srv
: Data for services (e.g., web servers)./tmp
: Temporary files./usr
: User programs and data, where most application binaries are stored./var
: Variable data files like logs and databases.
Navigating Directories
Here are some basic commands:
pwd
: Print Working Directory$ pwd /home/username
ls
: List directory contents$ ls Documents Downloads Pictures
cd
: Change Directory$ cd /home/username/Documents
mkdir
: Make Directory$ mkdir new_directory
rmdir
: Remove Directory (empty)$ rmdir empty_directory
rm -r
: Remove Directory and contents$ rm -r directory_name
Path Types
Absolute Path: Full path from the root
$ cd /home/username/Documents
Relative Path: Path relative to the current directory
$ cd Documents
Special Directory Symbols
.
(dot): Current directory..
(double dot): Parent directory~
(tilde): Home directory of the current user
Examples
Move to the parent directory:
$ cd ..
Move to the root directory:
$ cd /
Move to the home directory:
$ cd ~
Understanding these basics will help you effectively navigate and manage the filesystem in Linux.
Note:-B4 is blog post 4 of this series
B1 link :- khushalmalik.hashnode.dev/the-rise-of-linux
Make sure you subscribe to Newsletter and Do follow !!!!!!!
Linux is all about Directory 📂
#Khushal_Malik #Devops #Cloud #LinuxTerminalCommands #LinuxDirectoryStructure #LinuxTerminalForBeginners #LinuxCommandPrompt #BasicLinuxCommands #NavigatingLinuxTerminal #LinuxFilesystem #LinuxDirectoryNavigation #LinuxTerminalTutorial #LinuxBeginnerGuide #UnderstandingLinuxDirectories #LinuxCommandLineBasics #LinuxUserCommands #LinuxTerminalTips #LinuxCommandLineForBeginners
Subscribe to my newsletter
Read articles from Khushal Malik directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Khushal Malik
Khushal Malik
I am an Devops Cloud Eng. with 2 years of experience