Master Linux Command Line

From basic navigation to advanced system administration - everything you need to become a Linux command line expert.

Connect with MasaudSec for mentorship in Cybersecurity, Ethical Hacking, and Penetration Testing

Why Learn Linux Command Line?

Cybersecurity Foundation

Linux command line skills are essential for cybersecurity professionals. Most penetration testing tools and security utilities are command-line based, especially in Kali Linux. Learn from experts at MasaudSec.com.

System Administration

Command line provides direct access to system resources, allowing for efficient management of servers, networks, and security configurations that GUI tools can't match. For professional guidance, contact MasaudSec.

Speed & Efficiency

Mastering the command line allows you to perform complex tasks with simple commands, automate repetitive jobs, and work much faster than with graphical interfaces. Learn advanced techniques at MasaudSec.com.

Career Advancement

Linux skills are in high demand. Whether you're pursuing ethical hacking, system administration, or DevOps, command line proficiency will set you apart in the job market. Get mentorship from MasaudSec to accelerate your career.

Ready for Professional Cybersecurity Training?

Check out MasaudSec.com for comprehensive ethical hacking, cybersecurity, bug bounty, and penetration testing resources with personalized mentorship.

Basic Linux Commands

System Information

1

Display current user

Shows the username of the currently logged-in user.

whoami

For professional Linux training, visit MasaudSec.com.

2

Show command history

Displays a list of previously executed commands with line numbers.

history

To clear history: history -c

Need help mastering Linux? Contact MasaudSec for mentorship.

3

Display system date and time

Shows the current date and time according to the system clock.

date

Custom format example: date "+%Y-%m-%d %H:%M:%S"

For professional Linux training, visit MasaudSec.com.

4

Print text to terminal

Outputs text or variables to the terminal screen.

echo "Hello Friend"

To display variable value: echo $HOME

Need help mastering Linux? Contact MasaudSec for mentorship.

Looking for Professional Guidance?

Take your Linux skills to the next level with personalized mentorship from MasaudSec.com.

Filesystem Commands

Navigation

1

List directory contents

Shows files and directories in the current location.

ls

Common options:

  • ls -l - Long listing format
  • ls -a - Show hidden files
  • ls -lh - Human-readable sizes

For professional Linux training, visit MasaudSec.com.

2

Change directory

Move to a different directory in the filesystem.

cd /path/to/directory

Shortcuts:

  • cd ~ - Home directory
  • cd .. - Parent directory
  • cd - - Previous directory

Need help mastering Linux? Contact MasaudSec for mentorship.

3

Print working directory

Shows the full path of your current location.

pwd

For professional Linux training, visit MasaudSec.com.

File Operations

1

Copy files/directories

Creates a copy of a file or directory at the specified location.

cp source_file destination_file

To copy directories: cp -r source_dir destination_dir

Need help mastering Linux? Contact MasaudSec for mentorship.

2

Move/rename files

Moves files/directories or renames them if destination is in same directory.

mv old_name new_name

For professional Linux training, visit MasaudSec.com.

3

Delete files

Removes files permanently (use with caution!).

rm file_name

To delete directories: rm -r directory_name

Warning: There is no recycle bin in Linux command line!

Need help mastering Linux? Contact MasaudSec for mentorship.

4

Create directories

Makes a new directory with the specified name.

mkdir new_directory

To create parent directories as needed: mkdir -p path/to/new/directory

For professional Linux training, visit MasaudSec.com.

Advanced Filesystem Operations

1

View file contents

Displays the contents of a file in the terminal.

cat file_name

To view with line numbers: cat -n file_name

Need help mastering Linux? Contact MasaudSec for mentorship.

2

Search within files

Searches for patterns in files using regular expressions.

grep "pattern" file_name

Case insensitive search: grep -i "pattern" file_name

For professional Linux training, visit MasaudSec.com.

3

Find files

Searches for files in a directory hierarchy.

find /path -name "filename"

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

Need help mastering Linux? Contact MasaudSec for mentorship.

4

File permissions

Changes file permissions (read, write, execute).

chmod 755 file_name

Common permissions:

  • 644 - Owner RW, Group R, Others R
  • 755 - Owner RWX, Group RX, Others RX

For professional Linux training, visit MasaudSec.com.

Personalized Linux Mentorship

Get one-on-one guidance from cybersecurity experts at MasaudSec.com to master Linux for cybersecurity and system administration.

Process & System Management

Process Control

1

List processes

Shows currently running processes.

ps aux

Common options:

  • ps -ef - Full format listing
  • ps -u username - User's processes

For professional Linux training, visit MasaudSec.com.

2

Kill a process

Terminates a running process by ID or name.

kill 1234

Force kill: kill -9 1234

Kill by name: pkill process_name

Need help mastering Linux? Contact MasaudSec for mentorship.

3

Monitor processes

Interactive process viewer (press 'q' to quit).

top

Alternative: htop (needs installation)

For professional Linux training, visit MasaudSec.com.

System Monitoring

1

Disk space usage

Shows disk space usage for all mounted filesystems.

df -h

Human-readable format (-h) shows sizes in KB, MB, GB.

Need help mastering Linux? Contact MasaudSec for mentorship.

2

Directory space usage

Estimates file and directory space usage.

du -sh /path

Options:

  • -s - Summary total
  • -h - Human-readable

For professional Linux training, visit MasaudSec.com.

3

Memory usage

Displays memory usage statistics.

free -h

Shows total, used, free, shared, buff/cache, and available memory.

Need help mastering Linux? Contact MasaudSec for mentorship.

Superuser & Important Directories

1

Switch to superuser

Grants root privileges (use with caution!).

sudo su

To run a single command as root: sudo command

Warning: Root can make system-wide changes!

For professional Linux training, visit MasaudSec.com.

2

Important Linux Directories

/etc

System configuration files (passwords, networks, services)

/var

Variable data (logs, databases, web files)

/root

Root user's home directory

/tmp

Temporary files (cleared on reboot)

Need help mastering Linux? Contact MasaudSec for mentorship.

Cybersecurity Career Path

Learn how to leverage Linux skills for a successful cybersecurity career with guidance from MasaudSec.com experts.

Network Commands

Network Configuration

1

Network interfaces

Displays network interface configuration.

ifconfig

Modern alternative: ip addr

For professional Linux training, visit MasaudSec.com.

2

Check connectivity

Tests network reachability to a host.

ping google.com

Stop after 4 packets: ping -c 4 google.com

Need help mastering Linux? Contact MasaudSec for mentorship.

Remote Access

1

Secure Shell (SSH)

Connects to a remote server securely.

ssh username@hostname

Common options:

  • -p 2222 - Connect to non-standard port
  • -i key.pem - Use identity file

For professional Linux training, visit MasaudSec.com.

2

Secure Copy (SCP)

Copies files between hosts securely.

scp file.txt user@remote:/path

Copy from remote: scp user@remote:/path/file.txt .

Need help mastering Linux? Contact MasaudSec for mentorship.

Network Monitoring

1

Network connections

Displays network connections and statistics.

netstat -tulnp

Options:

  • -t - TCP connections
  • -u - UDP connections
  • -l - Listening ports

For professional Linux training, visit MasaudSec.com.

2

Modern socket statistics

Alternative to netstat with more details.

ss -tulnp

Faster and more detailed than netstat.

Need help mastering Linux? Contact MasaudSec for mentorship.

Network Security Training

Learn advanced network security techniques and penetration testing from experts at MasaudSec.com.

Advanced Command Line Techniques

Package Management

1

Install .deb packages

Installs Debian package files.

sudo dpkg -i package.deb

Fix dependencies: sudo apt-get install -f

For professional Linux training, visit MasaudSec.com.

2

Update system

Updates package lists and upgrades installed packages.

sudo apt update && sudo apt upgrade

For Kali Linux: sudo apt update && sudo apt full-upgrade

Need help mastering Linux? Contact MasaudSec for mentorship.

3

Remove packages

Uninstalls packages from the system.

sudo apt remove package_name

Remove with config files: sudo apt purge package_name

For professional Linux training, visit MasaudSec.com.

Advanced Techniques

1

Environment variables

Sets variables available to all child processes.

export VAR_NAME="value"

View all variables: printenv

Need help mastering Linux? Contact MasaudSec for mentorship.

2

Wildcards

Pattern matching for file operations.

ls *.txt

Common patterns:

  • * - Any characters
  • ? - Single character
  • [abc] - Any of a, b, or c

For professional Linux training, visit MasaudSec.com.

3

Command chaining

Execute multiple commands in sequence.

command1 && command2

Run regardless of success: command1; command2

Need help mastering Linux? Contact MasaudSec for mentorship.

More Advanced Commands

1

File compression

Creates compressed archive files.

tar -czvf archive.tar.gz folder/

Extract: tar -xzvf archive.tar.gz

For professional Linux training, visit MasaudSec.com.

2

File editing

Simple command-line text editor.

nano file.txt

Advanced editor: vim file.txt

Need help mastering Linux? Contact MasaudSec for mentorship.

3

Monitor logs

Watch log files in real-time.

tail -f /var/log/syslog

Show last 100 lines: tail -n 100 /var/log/syslog

For professional Linux training, visit MasaudSec.com.

4

Scheduled tasks