โฑ 5:00 remaining

Linux Command Line Basics

1 Global Definitions

  • Linux: An open-source operating system widely used in servers, security, and development environments.
  • Command Line Interface (CLI): A text-based interface for interacting with the operating system by typing commands.
  • Shell: The program that interprets and executes commands (e.g., bash, zsh).

1.1 File & Directory Commands

Navigation

Move through the filesystem using these commands:

  • pwd โ†’ print working directory
  • ls โ†’ list files and directories
  • cd /path โ†’ change directory

File Operations

Create, view, and delete files.

  • touch file.txt โ†’ create file
  • cat file.txt โ†’ view contents
  • rm file.txt โ†’ remove file

Directory Operations

Manage folders within the filesystem.

  • mkdir folder โ†’ create directory
  • rmdir folder โ†’ remove empty directory
  • rm -r folder โ†’ remove directory recursively

1.2 File Permissions

Viewing Permissions

Check who can read, write, or execute files.

  • ls -l โ†’ displays file permissions
  • Format: -rwxr-xr--

Changing Permissions

Modify access rights.

  • chmod 755 script.sh
  • rwx

Changing Ownership

Assign file ownership to users or groups.

  • chown user file.txt
  • chgrp group file.txt

1.3 Process Management

Monitoring

View running processes.

  • ps aux โ†’ list processes
  • top or htop โ†’ live monitoring

Managing Processes

Start, stop, and control processes.

  • kill PID โ†’ terminate process
  • kill -9 PID โ†’ force stop process
  • jobs, fg, bg โ†’ control jobs

1.4 Networking Basics

Network Configuration

Check and configure IP addresses.

  • ifconfig or ip addr
  • ping host โ†’ test connectivity
  • netstat -tuln โ†’ view open ports

File Transfer

Send and receive files over the network.

  • scp file user@host:/path
  • rsync -av file user@host:/path

1.5 Why Linux CLI Matters

The Linux command line gives users full control over the system, enabling efficient file management, process monitoring, and network configuration. For cybersecurity professionals, mastering the CLI is critical for penetration testing, digital forensics, and server administration.