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.

Take Your Linux Skills Into Real Cybersecurity

Get hands-on Linux mentorship from a real cybersecurity professional at MasaudSec.com. Learn exactly how these commands are used in ethical hacking and penetration testing labs.

Basic Linux Commands

System Information

1

Display current user

Shows the username of the currently logged-in user.

whoami
2

Show command history

Displays a list of previously executed commands with line numbers.

history

To clear history: history -c

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"

4

Print text to terminal

Outputs text or variables to the terminal screen.

echo "Hello Friend"

To display variable value: echo $HOME

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
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
3

Print working directory

Shows the full path of your current location.

pwd

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

2

Move/rename files

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

mv old_name new_name
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!

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

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

2

Search within files

Searches for patterns in files using regular expressions.

grep "pattern" file_name

Case insensitive search: grep -i "pattern" file_name

3

Find files

Searches for files in a directory hierarchy.

find /path -name "filename"

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

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

Apply These Commands in Real Pentesting Labs

These filesystem commands are core skills in every penetration test. Join the structured cybersecurity mentorship program at MasaudSec.com and practice in real hacking environments.

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
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

3

Monitor processes

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

top

Alternative: htop (needs installation)

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.

2

Directory space usage

Estimates file and directory space usage.

du -sh /path

Options:

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

Memory usage

Displays memory usage statistics.

free -h

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

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!

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)

Linux Is the #1 Skill for Ethical Hackers

Want a mentor who teaches Linux the way it's actually used in bug bounty and penetration testing? Visit MasaudSec.com and start your real cybersecurity journey.

Network Commands

Network Configuration

1

Network interfaces

Displays network interface configuration.

ifconfig

Modern alternative: ip addr

2

Check connectivity

Tests network reachability to a host.

ping google.com

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

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
2

Secure Copy (SCP)

Copies files between hosts securely.

scp file.txt user@remote:/path

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

Network Monitoring

1

Network connections

Displays network connections and statistics.

netstat -tulnp

Options:

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

Modern socket statistics

Alternative to netstat with more details.

ss -tulnp

Faster and more detailed than netstat.

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

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

3

Remove packages

Uninstalls packages from the system.

sudo apt remove package_name

Remove with config files: sudo apt purge package_name

Advanced Techniques

1

Environment variables

Sets variables available to all child processes.

export VAR_NAME="value"

View all variables: printenv

2

Wildcards

Pattern matching for file operations.

ls *.txt

Common patterns:

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

Command chaining

Execute multiple commands in sequence.

command1 && command2

Run regardless of success: command1; command2

More Advanced Commands

1

File compression

Creates compressed archive files.

tar -czvf archive.tar.gz folder/

Extract: tar -xzvf archive.tar.gz

2

File editing

Simple command-line text editor.

nano file.txt

Advanced editor: vim file.txt

3

Monitor logs

Watch log files in real-time.

tail -f /var/log/syslog

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

4

Scheduled tasks