0% found this document useful (0 votes)
242 views

Linux For Devops

This document provides a comprehensive overview of common Linux commands organized into categories including: file and directory navigation, manipulation and viewing; copying, moving and linking files; text editing and processing; networking information and configuration; firewall management; system information and administration; user and group management; file permissions; compression; process and memory monitoring; and advanced text filtering. The commands described allow users to manage files, directories, users and permissions as well as monitor and configure the system and network.

Uploaded by

Muhammad Salman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
242 views

Linux For Devops

This document provides a comprehensive overview of common Linux commands organized into categories including: file and directory navigation, manipulation and viewing; copying, moving and linking files; text editing and processing; networking information and configuration; firewall management; system information and administration; user and group management; file permissions; compression; process and memory monitoring; and advanced text filtering. The commands described allow users to manage files, directories, users and permissions as well as monitor and configure the system and network.

Uploaded by

Muhammad Salman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

List Files/Directories:

● ls: List files in the current directory.


● ls -l: List files with detailed information.
● ls -la: List all files, including hidden ones.

Navigation:
● cd: Change directory.
● pwd: Print current working directory.

Directory Management:
● mkdir: Create a new directory.
● rm: Remove files.
● rmdir: Remove an empty directory.

File Viewing:
● echo: Use to display/print on screen.
● cat: Concatenate and display file content.
● zcat: Display compressed file content.
● touch: Create an empty file.
● head: Display the first few lines of a file.
● tail: Display the last few lines of a file.
● tail -f: Display and continuously update the last part of a file.
● less: View file content interactively.
● more: Display file content one screen at a time.

File Copy/Move:
● cp: Copy files or directories.
● mv: Move or rename files or directories.

Word Count:
● wc: Count lines, words, and characters in a file.

Text Editors:
● vi: Open the vi text editor.
● nano: Open the nano text editor.
Linking Files:
● ln: Create hard or soft links.
● ln -s file-path dest: Create a symbolic link.

Text Processing:
● cut: Cut out selected portions of a file.
● tee: Redirect output to multiple files.
● sort: Sort lines of text.
● clear: Clear the terminal screen.
● diff: Compare files line by line.

Networking:

Routing and Network Scanning:


● route: Display or manipulate the IP routing table.
● nmap: Network exploration tool and security scanner.
● wget: Retrieve content from web servers.
● watch: Execute a program periodically.
● iptables: Administration tool for IPv4 packet filtering.
● curl: Transfer data with URLs.
● ssh: Secure Shell.

Network Information:
● ping: Send ICMP Echo Request to network hosts.
● netstat: Display network connections and routing tables.
● ifconfig: Configure network interfaces.
● traceroute: Trace the route that packets take.
● tracepath: Traceroute to a network host.
● mtr: Network diagnostic tool.
● nslookup: Query Internet domain name servers.
● telnet: Communicate with another host using the Telnet protocol.
● hostname: Show or set the system's host name.
● ip: Show or manipulate routing, devices, policy routing, and tunnels.
● iwconfig: Configure wireless network interfaces.
● ss: Show socket statistics.
● arp: Display or manipulate the ARP table.
● dig: DNS lookup utility.
● nc: Netcat - networking utility.
● whois: Query WHOIS database.
● ifplugstatus: Check the status of a network interface plug.

Firewall Management:

IPTables:
● iptables -L: List current firewall rules.
● iptables -A INPUT -p tcp --dport 22 -j ACCEPT: Allow SSH traffic on port
22.
● iptables -A INPUT -j DROP: Drop all other incoming traffic.
● iptables-save > /etc/iptables/rules.v4: Save current firewall rules.
● iptables-restore < /etc/iptables/rules.v4: Restore firewall rules from a
file.

UFW (Uncomplicated Firewall):


● ufw status: Show the current status of UFW.
● ufw enable: Enable the firewall.
● ufw allow 80/tcp: Allow incoming traffic on port 80.
● ufw deny 8080/tcp: Deny incoming traffic on port 8080.
● ufw delete 2: Delete the rule with index 2.

IPSet:
● ipset create myset hash:ip: Create an IPSet named 'myset'.
● ipset add myset 192.168.1.1: Add an IP address to the IPSet.
● ipset list myset: List the contents of the IPSet.

System-Level Commands:

System Information:
● uname: Print system information.
● uptime: Display how long the system has been running.
● date: Print or set the system date and time.
● who: Show who is logged on.
● whoami: Print the effective username.
● which: Show the full path of shell commands.
● id: Print user and group information.

System Administration:
● sudo: Execute a command as another user.
● shutdown: Halt or reboot the system.
● reboot: Reboot the system.
● apt: Advanced Package Tool (for Debian-based systems).
● yum: Yellowdog Updater Modified (for RPM-based systems).
● dnf: Package manager for RPM-based Linux distributions.

User & Group Management:

User Management:
● sudo: Execute a command as another user.
● useradd: Create a new user account.
● su: Switch user.
● passwd: Change user password.
● userdel: Delete a user account.

Group Management:
● groupadd: Create a new group.
● gpasswd: Administer /etc/group and /etc/gshadow.
● groupdel: Delete a group.

File Permission:

File Permissions:
● umask: Set the file creation mask.
● ls -l: List files with detailed information.
● chmod: Change file mode bits.
● chown: Change file owner and group.
● chgrp: Change group ownership of a file.

Compression Commands:

Compression:
● zip: Package and compress files.
● tar: Archive files.
● tar -xvf: Extract files from a tar archive.

File Transfer:

File Transfer:
● scp: Secure Copy Protocol.
● rsync: Remote file synchronization.

Process and System Monitoring:

Process Management:
● ps: Report a snapshot of the current processes.
● top: Display and update sorted information about system processes.
● fuse: Implement a filesystem in userspace.
● kill: Terminate or signal processes.
● nohup: Run a command immune to hangups.
● free: Display amount of free and used memory.
● vmstat: Report virtual memory statistics.
● vmstat -a: Display active and inactive memory statistics.

Advanced Text Processing:

Text Processing:
● awk: Pattern scanning and processing language.
● sed: Stream editor for filtering and transforming text.
● grep: Print lines matching a pattern.
These commands cover a wide range of tasks, from basic file manipulation to system
administration and network management on a Linux system.

You might also like