
10:50
60 Linux Commands you NEED to know (in 10 minutes)
NetworkChuck
Overview
This video provides a rapid-fire introduction to 60 essential Linux commands, categorized for clarity. It covers fundamental operations like navigation, file manipulation, user management, package installation, network diagnostics, system monitoring, and process control. The presenter emphasizes practical application and offers tips for efficient command-line usage, aiming to equip viewers with the core tools needed to interact with a Linux environment effectively.
How was this?
Save this permanently with flashcards, quizzes, and AI chat
Chapters
- SSH allows remote connection to Linux machines using username and server address.
- LS lists files in the current directory, with '-l' for detailed view and '-a' for hidden files.
- PWD shows the current working directory.
- CD changes directories, with '..' moving up one level and no argument returning to home.
Understanding how to connect and navigate your file system is the absolute first step to using any Linux system effectively.
To connect to a server with IP 192.168.1.100 as user 'admin', you would type 'ssh admin@192.168.1.100'.
- TOUCH creates new, empty files.
- ECHO writes text to files, overwriting or appending with '>'.
- NANO and VIM are text editors for modifying file content; NANO is simpler, VIM is more powerful but has a steeper learning curve.
- CAT displays file content, SHRED securely deletes files.
- MKDIR creates directories, CP copies files, MV moves/renames files, RM deletes files, and RMDIR deletes empty directories (or RM -r for non-empty ones).
Efficiently creating, editing, moving, and deleting files and directories is crucial for organizing your work and managing system resources.
To create a file named 'notes.txt', edit it using Nano, and then display its content, you would use: `touch notes.txt`, `nano notes.txt`, and `cat notes.txt`.
- WHOAMI identifies the current user.
- ADDUSER creates new user accounts, often requiring SUDO (superuser do) for elevated privileges.
- PSUEDO (or SUDO) executes commands with administrative rights.
- SU switches to another user account.
- PASSWD changes user passwords.
Managing users and understanding permissions is vital for security and for performing administrative tasks on a multi-user system.
To create a new user named 'testuser', you would likely use `sudo adduser testuser`.
- APT (on Debian/Ubuntu) and YUM (on Red Hat/CentOS) are package managers for installing, updating, and removing software.
- Commands like APT UPDATE and APT INSTALL are used to manage software.
- MAN pages provide comprehensive documentation for commands.
- WHATIS and WHICH offer quick information about commands and their locations.
Knowing how to install software and access help documentation is essential for expanding your system's capabilities and troubleshooting issues.
To find out how the 'grep' command works, you would type `man grep` and press 'q' to exit.
- GET and CURL download files from the internet.
- ZIP and UNZIP compress and decompress files.
- LESS, HEAD, and TAIL display file content page-by-page, from the beginning, and from the end, respectively.
- CMP and DIFF compare files to find differences.
- SORT arranges lines of text alphabetically.
- FIND locates files based on various criteria.
- CHMOD changes file permissions (e.g., to make a file executable).
- CHOWN changes file ownership.
These commands are fundamental for transferring data, managing file archives, processing text, and controlling access to files.
To download a file from 'example.com/data.zip' and save it locally as 'archive.zip', you could use `curl http://example.com/data.zip -o archive.zip`.
- IFCONFIG and IP ADDRESS display network interface information.
- GREP filters output based on patterns, useful for isolating specific information (e.g., IP addresses).
- PING checks network connectivity to a host.
- TRACEROUTE shows the network path to a destination.
- NETSTAT and SS display network connections and listening ports.
- UFW (Uncomplicated Firewall) simplifies firewall management.
- UNAME provides system information.
- NEOFETCH displays system information in a visually appealing format.
- CAL shows a calendar.
- FREE and DF report memory and disk space usage, respectively.
- PS, TOP, and HTOP display running processes, with TOP and HTOP showing real-time resource usage.
Monitoring your system's health, network status, and resource usage is critical for performance tuning and security.
To see if a website is reachable and how long it takes to respond, you would use `ping google.com` and press Ctrl+C to stop.
- KILL and PKILL terminate processes, PKILL by name and KILL by Process ID (PID).
- SYSTEMCTL (or SERVICE) manages system services (start, stop, restart, status).
- HISTORY lists previously executed commands.
- REBOOT and SHUTDOWN restart or power off the system, respectively, often requiring SUDO.
Understanding how to manage running processes and safely shut down or restart your system are essential administrative tasks.
To forcefully stop a process with PID 12345, you would use `kill -9 12345`.
Key takeaways
- Mastering basic navigation (PWD, CD) and file listing (LS) is the foundation of Linux command-line proficiency.
- Text editors like NANO and VIM are essential for modifying configuration files and creating scripts.
- Privilege escalation using SUDO is required for many system-level operations.
- Package managers (APT, YUM) are the standard way to install and manage software.
- Commands like MAN and WHATIS are invaluable resources for learning and troubleshooting.
- Network diagnostic tools (PING, TRACEROUTE, NETSTAT) are crucial for understanding connectivity.
- Process monitoring tools (TOP, HTOP) help identify resource-intensive applications.
- Safe system shutdown and reboot procedures are critical for data integrity.
Key terms
SSHLSPWDCDTOUCHECHONANOVIMCATRMMKDIRCPMVSUDOAPTYUMMANGETCURLZIPUNZIPLESSHEADTAILCMPDIFFSORTFINDCHMODCHOWNIFCONFIGIP ADDRESSGREPPINGTRACEROUTENETSTATSSUFWUNAMENEOFETCHCALFREEDFPSTOPHTOPKILLPKILLSYSTEMCTLHISTORYREBOOTSHUTDOWN
Test your understanding
- How would you navigate to the '/var/log' directory and then list all files within it, including hidden ones?
- What is the difference between the `cp` and `mv` commands, and when would you use each?
- Why is it important to use `sudo` before certain commands, and what are the potential risks of using it incorrectly?
- If you need to find out how to use the `grep` command, what command would you use, and how would you exit the documentation?
- Describe a scenario where you might use `ping` and `traceroute` to diagnose a network issue.