Linux Fundamentals: A Comprehensive Guide to File System Navigation, Operations, and User Management

Linux Fundamentals: Essential Commands and Operations

Linux Fundamentals: A Comprehensive Guide

File System Navigation

Listing Directory Contents

Listing Directory Contents
# List all contents
ls

# List contents including hidden files
ls -a

# List detailed file information
ls -l

# List detailed information including hidden files
ls -la

Changing Directories

Changing Directories
# Move to root directory
cd /

# Move to home directory
cd

# Move to previous directory
cd -

# Move up one directory level
cd ..

# Move to specific directory
cd /var/log

Finding Executable Paths

Finding Executable Paths
# Find bash executable path
which bash

# Print current shell
echo $SHELL

File and Directory Operations

File and Directory Operations
# Create a new directory
mkdir linux_fundamentals

# Create an empty file
touch example.txt

# Copy file to another directory
cp example.txt scripts/

# Move file to another directory
mv example.txt backup/

File Permissions

File Permissions
# Change file permissions
# 6 = read and write (4+2)
# 4 = read-only
chmod 644 example.txt

User and Group Management

User and Group Management
# Add a new user
sudo useradd student

# Set user password
sudo passwd student

# Add a new group
sudo groupadd students

# Change file ownership
sudo chown student example.txt
sudo chgrp students example.txt

Ownership

Ownership
# Show the current folder path
pwd

# Give permission to the report.txt file
chmod 644 report.txt

# Give permission to the project folder
chmod 755 project

User Management

User Management
# Create a new directory developer_home
sudo mkdir /home/developer_home

# Set home directory for user
sudo usermod -d /home/developer_home -m developer

# Assign shell to user
sudo usermod -s /bin/sh developer

# Change username
sudo usermod -l devuser developer

Hard and Soft Links

Hard and Soft Links
# Create a symbolic link
ln -s original.txt softlink.txt

# Create a hard link
ln original.txt hardlink.txt

# Find all .txt files
find . -name "*.txt"

Package Management

Package Cache Update Package Installation
# Update repository cache
sudo apt update

# Install a package
sudo apt install tree

🐧 Note: Always be cautious when running commands with sudo and ensure you understand their implications. 🛡️

Comprehensive guide to Linux fundamentals with practical examples.

Comments