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

Basic Linux Command

Uploaded by

Ayush Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Basic Linux Command

Uploaded by

Ayush Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Vaishnavu c v | VAPT

[email protected]

Basic Linux commands that a beginner should know.

Contents
Basic Linux commands ................................................................................................................................................... 2
Networking Commands:................................................................................................................................................. 2
Service Commands: ........................................................................................................................................................ 3
System Administration Commands:.............................................................................................................................. 3
Linux file system/ Directory ........................................................................................................................................... 4
Explanation of Each Directory: .................................................................................................................................. 5
Vaishnavu c v | VAPT
[email protected]

Basic Linux commands


• ls: List directory contents
• cd: Change directory
• pwd: Print working directory
• mkdir: Make a directory
• rmdir: Remove directory
• touch: Create a new file
• rm: Remove files or directories
• cp: Copy files or directories
• mv: Move or rename files or directories
• man: Display the user manual
• echo: Display a message or data
• chmod: Change file permissions
• chown: Change file owner and group
• ps: Display a list of currently running processes
• kill: Kill a process
• top: Display system summary and processes
• df: Display disk space usage
• du: Estimate file and directory space usage
• cat: Concatenate and display file content
• nano, vi: Text editors
• clear: Clear the terminal screen
• exit: Exit the terminal

Networking Commands:
1. ping: Test the network connection between the host and a destination computer.
o Example: ping google.com
2. ifconfig (or ip a): Display or configure a network interface.
3. netstat: Display network connections, routing tables, interface statistics, etc.
o Example: netstat -tuln (Displays listening ports)
4. traceroute: Display the route and transit delays of packets across a network.
o Example: traceroute google.com
5. nslookup: Query the DNS to obtain domain name or IP address mapping.
o Example: nslookup example.com
6. dig: DNS lookup utility.
o Example: dig example.com
7. route: Show or manipulate the IP routing table.
o Example: route -n
8. ss: Utility to investigate sockets.
o Example: ss -tuln
9. iwconfig: Configure a wireless network interface.
Vaishnavu c v | VAPT
[email protected]
Service Commands:
1. systemctl: Control the systemd system and service manager.
o Example: systemctl start service_name (Starts a service)
o Example: systemctl stop service_name (Stops a service)
o Example: systemctl status service_name (Checks the status of a service)
2. service: Utility for initializing and managing services.
o Example: service service_name start
3. journalctl: Query and display messages from the journal.
o Example: journalctl -u service_name (Displays logs for a specific service)
4. chkconfig: Tool for managing SysV init scripts.
o Example: chkconfig --list (Lists all services and their status)
5. ufw: Uncomplicated Firewall, a user-friendly way to manage iptables.
o Example: ufw enable (Enables the firewall)
o Example: ufw allow 22/tcp (Allows SSH traffic)

System Administration Commands:


1. sudo: Execute a command as the superuser or another user.
o Example: sudo apt-get update (Updates the package list on Debian-based systems)
2. apt-get or yum or dnf: Package management commands for Debian-based (apt-get) or Red Hat-
based (yum/dnf) systems.
o Example: apt-get install package_name (Installs a package on Debian-based systems)
o Example: yum install package_name (Installs a package on older Red Hat-based systems)
o Example: dnf install package_name (Installs a package on newer Red Hat-based
systems)
3. passwd: Change a user's password.
o Example: passwd username
4. useradd and userdel: Add or delete a user account.
o Example: useradd new_username
o Example: userdel username
5. groupadd and groupdel: Add or delete a group.
o Example: groupadd new_groupname
o Example: groupdel groupname
6. df: Display disk space usage for file systems.
o Example: df -h (Displays in human-readable format)
7. du: Estimate file and directory space usage.
o Example: du -sh directory_name (Displays total space used by a directory)
8. free: Display the amount of free and used memory in the system.
o Example: free -m (Displays memory info in MB)
9. top or htop: Display dynamic real-time view of running processes.
o Example: top
o Example: htop (Note: htop might need to be installed separately)
Vaishnavu c v | VAPT
[email protected]
10. uname: Display system information.

o Example: uname -a (Displays all system information)

11. lshw: List hardware configuration.

o Example: lshw -short (Provides a concise overview of the system's hardware)

12. shutdown or reboot: Shutdown or reboot the system.

o Example: shutdown -h now (Shuts down the system immediately)


o Example: reboot (Reboots the system)

13. crontab: Schedule tasks to run automatically at specified intervals.

o Example: crontab -e (Edit the current user's cron jobs)


o Example: crontab -l (List the current user's cron jobs)

14. tar: Archive files.

o Example: tar -czvf archive_name.tar.gz directory_name (Creates a gzipped tarball)

15. gzip and gunzip: Compress or decompress files.

o Example: gzip file_name (Compresses a file)


o Example: gunzip file_name.gz (Decompresses a gzipped file)

Linux file system/ Directory


Vaishnavu c v | VAPT
[email protected]
Explanation of Each Directory:

1. / (Root): The starting point for the file system hierarchy. All other directories are subdirectories of
the root directory.
2. /bin: Contains essential command binaries required for booting and repairing the system.
3. /etc: Holds system-wide configuration files and shell scripts used to initialize system settings for
applications.
4. /home: Home directories for all users. Each user has a subdirectory named after their username.
5. /var: Contains variable data files such as logs, databases, and temporary files.
6. /usr: Contains user binaries, libraries, documentation, etc. It's a secondary hierarchy for read-only
user data.
7. /lib: Contains essential shared libraries and kernel modules.
8. /dev: Contains device files which represent hardware components.
9. /tmp: Temporary storage for files. It's cleared on system reboot.
10. /opt: Optional application software packages.
11. /sbin: Contains system binaries essential for booting, restoring, and recovering the system.
12. /srv: Contains data for services provided by the system.
13. /proc: A virtual filesystem that provides detailed information about kernel and processes.
14. /sys: A virtual filesystem that provides an interface to kernel data structures.
15. /run: Contains runtime data for processes started since the last boot.
16. /boot: Contains files needed to start the boot process.
17. /mnt: Temporary mount points for mounting filesystems.
18. /media: Mount points for removable media like USB drives and CDs.

You might also like