In NetworkChuck’s video titled “60 Linux Commands you NEED to know (in 10 minutes),” he covers the top 60 Linux commands that are essential for both beginners and experienced Linux users. The video is sponsored by Linode, a platform that provides virtual machines for performing Linux tasks. The commands discussed in the video range from basic file manipulation commands like ls, touch, and cp to more advanced commands like grep, awk, and netstat. NetworkChuck also covers important commands for system control, networking, and user management. Whether you’re a newbie or a Linux pro, this video is a must-watch to enhance your Linux skills.
The video begins with an introduction to the SSH command, which is crucial for connecting to your Linux machine. NetworkChuck then moves on to commands like ls, pwd, cd, touch, and echo, explaining their functions and how to use them effectively. He also provides useful tips and tricks for file manipulation, such as using the nano and vim editors, creating directories with mkdir, and copying and removing files and directories. Additionally, he covers essential networking commands like ping, netstat, and ifconfig. Whether you’re a Linux beginner or an experienced user looking to expand your knowledge, this video will equip you with the necessary Linux commands you need to know.
File Manipulation
ls
The ls
command is used to list all the files and directories in the current directory. By default, it displays the names of the files in the current directory. However, you can use different options to customize its output, such as showing detailed information about the files (-l
option), showing hidden files (-a
option), or sorting the files by size or date (-S
or -t
option).
pwd
The pwd
command stands for “print working directory”. It is used to display the current directory you are in. This command can be useful when navigating through the file system or when you want to know the full path of the current directory.
cd
The cd
command is used to change the current directory. By specifying the name of the directory you want to navigate to after the cd
command, you can move to the specified directory. You can use relative paths or absolute paths to specify the directory. For example, cd ..
will move up one directory, while cd /home/user/documents
will move to the /home/user/documents
directory.
touch
The touch
command is used to create empty files or update the timestamp of existing files. It is a useful command for creating new files quickly. For example, touch file.txt
will create a new file named file.txt
in the current directory.
echo
The echo
command is used to display text on the terminal. It can be used for various purposes, such as printing messages or displaying the value of variables. For example, echo Hello, World!
will display the text “Hello, World!” on the terminal.
nano
The nano
command is a simple text editor that is easy to use for beginners. It can be used to create and edit text files. When you run the nano
command followed by the name of the file you want to edit, the nano
editor will open, allowing you to make changes to the file.
vim
The vim
command is a powerful text editor that is popular among experienced Linux users. It has many advanced features and can be customized to suit individual preferences. By running the vim
command followed by the name of the file you want to edit, you can open the file in the vim
editor and start editing.
cat
The cat
command is used to display the contents of a file on the terminal. It is a simple and straightforward way to view the contents of a file. For example, cat file.txt
will display the contents of the file.txt
file on the terminal.
shred
The shred
command is used to securely delete files by overwriting the file contents with random data. This makes it virtually impossible to recover the original data from the file. It is a useful command when you want to permanently delete sensitive files.
mkdir
The mkdir
command is used to create directories. By specifying the name of the directory you want to create after the mkdir
command, you can create a new directory with the specified name. For example, mkdir new_directory
will create a new directory named new_directory
in the current directory.
cp
The cp
command is used to copy files and directories. By specifying the name of the file or directory you want to copy, followed by the destination directory, you can make a copy of the specified file or directory. For example, cp file.txt /home/user/documents/
will copy the file.txt
file to the /home/user/documents/
directory.
rm
The rm
command is used to remove files and directories. By specifying the name of the file or directory you want to remove after the rm
command, you can delete the specified file or directory. Be careful when using this command, as it permanently deletes the files and directories without confirmation. To force the removal of files or directories, you can use the -f
option.
rmdir
The rmdir
command is used to remove empty directories. Unlike the rm
command, which can remove both files and directories, the rmdir
command only removes directories that do not contain any files or directories. If you try to use the rmdir
command on a non-empty directory, you will get an error.
ln
The ln
command is used to create links to files and directories. There are two types of links that can be created: hard links and symbolic links. Hard links create an additional reference to the original file or directory, while symbolic links create a new file or directory that points to the original file or directory. Links can be useful when you want to access a file or directory from multiple locations without duplicating it.
User Management
clear
The clear
command is used to clear the terminal screen, removing all previous commands and outputs from the display. This command can be useful when the terminal screen becomes cluttered and you want to start with a clean slate.
whoami
The whoami
command is used to display the username of the current user. It can be useful when you need to know your own username, especially when working on a shared system where multiple users are logged in.
useradd
The useradd
command is used to create new user accounts on the system. By specifying the username as an argument to the useradd
command, you can create a new user with the specified username. Additional options can be used to set the user’s home directory, shell, and other parameters.
sudo
The sudo
command is used to execute commands with superuser (root) privileges. By prefixing a command with sudo
, you can run the command as the root user or another user with sufficient privileges. This command is often used when administrative access is required to perform certain actions on the system.
adduser
The adduser
command is similar to the useradd
command and is used to add new user accounts on the system. However, the adduser
command provides an interactive interface that prompts you for additional information, such as the user’s password, full name, and contact information.
su
The su
command is used to switch to a different user account. By specifying the username as an argument to the su
command, you can switch to the specified user’s account. If you do not specify a username, the su
command will switch to the root user account by default.
exit
The exit
command is used to exit the current session or shell. It can be used to log out of a user account or to terminate a terminal session. When used in a shell script or a subshell, the exit
command is used to terminate the script or subshell and return control to the parent shell.
passwd
The passwd
command is used to change the password for a user account. By running the passwd
command followed by the username, you can change the password for that user account. The command will prompt you to enter the new password and confirm it.
Networking
ssh
The ssh
command is used to establish a secure shell connection with a remote host. By specifying the username and hostname of the remote host after the ssh
command, you can log in to the remote host and access its command-line interface. This command is commonly used for remote administration and file transfers.
ping
The ping
command is used to check the connectivity and response time of a remote host. By running the ping
command followed by the IP address or hostname of the remote host, you can send ICMP echo requests to the host and measure the round-trip time for each response. This command is commonly used to troubleshoot network connectivity issues.
netstat
The netstat
command is used to display network connections, routing tables, and network statistics. By running the netstat
command with appropriate options, you can view information about active network connections, listening ports, and other networking-related details. This command is commonly used to diagnose network-related issues and monitor network activity.
ss
The ss
command is similar to the netstat
command and is used to display network connections, routing tables, and socket statistics. By running the ss
command with appropriate options, you can view information about active network connections, listening ports, and other networking-related details. This command provides a more detailed and streamlined output compared to netstat
.
ifconfig
The ifconfig
command is used to configure and display network interface parameters. By running the ifconfig
command followed by the name of the network interface, you can view and modify parameters such as IP address, netmask, and MAC address. This command is commonly used to configure network interfaces and troubleshoot network connectivity issues.
ip address
The ip address
command is similar to the ifconfig
command and is used to display and modify network interface parameters. By running the ip address
command followed by the name of the network interface, you can view and modify parameters such as IP address, netmask, and MAC address. This command provides more advanced functionality compared to ifconfig
.
grep
The grep
command is used to search for specific patterns or text in files or command output. By running the grep
command followed by the pattern you want to search for and the file or command output you want to search in, you can filter the output to show only the lines that match the specified pattern. This command supports regular expressions and provides powerful searching capabilities.
awk
The awk
command is a versatile text-processing tool that is used to manipulate and analyze structured data. It operates on a line-by-line basis and allows you to select specific fields, perform calculations, and apply conditionals to the data. The awk
command is typically used in combination with other commands to extract and transform data.
resolvectl status
The resolvectl status
command is used to display the status of the DNS resolver configuration. By running this command, you can view information about the DNS servers configured on your system, as well as the domain name search list and other relevant settings. This command is useful for troubleshooting DNS-related issues and verifying the DNS configuration.
System Control
ufw
The ufw
command is a user-friendly command-line interface for managing the Uncomplicated Firewall (UFW) on Ubuntu-based systems. It provides a simplified interface to configure firewall rules and control network traffic. With ufw
, you can easily enable or disable ports, allow or deny specific connections, and view the current firewall status.
iptables
The iptables
command is a powerful and flexible firewall utility in Linux. It allows you to define and manipulate firewall rules to control network traffic. By running the iptables
command with the appropriate options and parameters, you can configure firewall policies, filter packets, and perform network address translation (NAT). This command is more advanced and provides fine-grained control over the firewall configuration compared to ufw
.
uname
The uname
command is used to display information about the system and the kernel. By running the uname
command with various options, you can retrieve details such as the system’s hostname, operating system type, kernel version, and processor architecture. This command is commonly used for system identification and troubleshooting purposes.
neofetch
The neofetch
command is a command-line tool used to display system information in a visually appealing way. By running the neofetch
command, you can view details such as the system’s logo, hostname, operating system, kernel version, and hardware specifications. This command is popular among Linux enthusiasts and is often used to showcase system configurations or for desktop customization.
cal
The cal
command is used to display a calendar for the current month or a specified month and year. By running the cal
command without any options, it will display the calendar for the current month. You can also specify a month and year using the -m
and -y
options, respectively, to display the calendar for a specific month or year.
reboot
The reboot
command is used to restart the system. By running the reboot
command, the system will initiate the reboot process and all processes and services will be stopped before the system is restarted. This command requires superuser (root) privileges and should be used with caution, as it will abruptly interrupt any ongoing tasks.
shutdown
The shutdown
command is used to shut down the system in an orderly manner. By running the shutdown
command followed by the desired options, you can schedule a system shutdown at a specific time, send a notification message to logged-in users, or specify the reason for the shutdown. This command requires superuser (root) privileges and allows you to gracefully terminate all processes and close network connections before shutting down the system.
Package Management
apt
The apt
command is a package management tool used in Ubuntu-based distributions to install, update, and remove software packages. It provides an easy-to-use interface to download and install software from package repositories. By running the apt
command followed by appropriate options, you can search for packages, install or remove packages, update the package database, and upgrade installed packages.
File Compression/Extraction
curl
The curl
command is a powerful tool used to transfer data to or from various protocols, including HTTP, FTP, and more. It can be used to download files from the internet, upload files to a server, send requests to web services, and perform a variety of network-related tasks. By using the curl
command followed by the URL of the resource or service, you can initiate the data transfer.
zip
The zip
command is used to create compressed archive files in the ZIP format. By specifying the name of the ZIP file you want to create and the files or directories you want to include in the archive, you can compress multiple files into a single archive file. This command supports various options for managing the compression level, file permissions, and other archive properties.
unzip
The unzip
command is used to extract files from ZIP archives. By specifying the name of the ZIP file you want to extract and the destination directory where you want the extracted files to be placed, you can extract the contents of the archive. This command supports various options for controlling the extraction process, such as extracting specific files or directories, preserving file permissions, and overwriting existing files.
File Viewing/Manipulation
less
The less
command is a popular pager utility that allows you to view the contents of a file or command output one page at a time. It is particularly useful for viewing long files or command output that may not fit on a single screen. By running the less
command followed by the name of the file or command, you can navigate through the contents using keyboard shortcuts and search for specific patterns.
head
The head
command is used to display the beginning lines of a file. By running the head
command followed by the number of lines you want to display and the name of the file, you can view the specified number of lines from the beginning of the file. This command is commonly used to preview the contents of a file or to extract the first few lines for further processing.
tail
The tail
command is used to display the last lines of a file. By running the tail
command followed by the number of lines you want to display and the name of the file, you can view the specified number of lines from the end of the file. This command is commonly used to monitor log files or to extract the last few lines of a file for analysis.
cmp
The cmp
command is used to compare two files byte by byte and display the differences, if any. By running the cmp
command followed by the names of the two files you want to compare, you can check if the files are identical or determine the offset and byte position of the first difference between the files. This command is useful for verifying the integrity of files or identifying changes between versions.
diff
The diff
command is used to compare the contents of two files line by line and display the differences. By running the diff
command followed by the names of the two files you want to compare, you can view the added, modified, or deleted lines between the files. This command is commonly used for comparing text files, detecting changes in configuration files, or generating patches for version control systems.
sort
The sort
command is used to sort the lines of a file or command output alphabetically or numerically. By running the sort
command followed by the name of the file or command, you can arrange the lines in ascending or descending order based on the specified criteria. This command is often used to sort text files, CSV files, or tabular data.
find
The find
command is used to search for files and directories in a directory hierarchy based on various criteria. By running the find
command followed by the starting directory and the search conditions, you can locate files and directories that match the specified criteria. This command supports a wide range of options for specifying file types, file properties, search depth, and more.
File Permissions
chmod
The chmod
command is used to modify the permissions of a file or directory. By running the chmod
command followed by the desired permission settings and the name of the file or directory, you can change the permissions to allow or deny read, write, and execute access for the owner, group, and others. This command uses symbolic or numeric notation to specify the permissions.
chown
The chown
command is used to change the ownership of a file or directory. By running the chown
command followed by the new owner’s username or user ID and the name of the file or directory, you can transfer ownership to another user. This command is commonly used when transferring files between users or when adjusting file ownership after system migrations.
System Resource Management
free
The free
command is used to display information about the system’s memory usage. By running the free
command, you can view the total amount of physical memory, the amount of memory used by different components of the system, and the amount of free memory. This command is useful for monitoring memory usage and identifying potential memory bottlenecks.
df
The df
command is used to display information about the system’s disk space usage. By running the df
command, you can view the total size, used space, available space, and filesystem type for each mounted filesystem. This command provides an overview of the disk usage across different partitions or storage devices.
ps
The ps
command is used to display information about the currently running processes on the system. By running the ps
command, you can view the process ID, parent process ID, user, CPU usage, memory usage, and other details for each process. This command is useful for monitoring system resources, identifying misbehaving processes, and managing process lifecycles.
top
The top
command is an interactive tool used to monitor system resources and display a real-time list of the most CPU-intensive processes. By running the top
command, you can view the CPU usage, memory usage, process ID, and other details for each process. This command allows you to sort processes by different criteria and provides dynamic updates every few seconds.
htop
The htop
command is a more advanced version of the top
command and provides an interactive text-based process viewer for system monitoring. By running the htop
command, you can view a color-coded list of processes, CPU load, memory usage, and other system statistics. This command offers a more user-friendly interface compared to top
and allows for easy navigation and process management.
kill
The kill
command is used to send signals to processes to terminate them. By running the kill
command followed by the process ID or name, you can send a signal to a specific process to terminate it gracefully. The default signal sent by kill
is SIGTERM
, which allows the process to clean up and exit gracefully. However, you can specify different signals using signal numbers or signal names to perform other actions, such as forcing the process to terminate immediately.
pkill
The pkill
command is similar to the kill
command and is used to send signals to processes based on their names or other attributes. By running the pkill
command followed by the name or pattern of the process you want to terminate, you can send a signal to all processes that match the specified criteria. This command is useful for quickly terminating multiple processes that share a common name or attribute.
systemctl
The systemctl
command is used to manage system services and control the systemd init system. By running the systemctl
command followed by appropriate options, you can start, stop, restart, enable, disable, or check the status of services. This command is commonly used for managing daemons, configuring services to start on boot, and troubleshooting service-related issues.
Command Management
history
The history
command is used to display a list of previously executed commands in chronological order. By running the history
command, you can view the command history for the current user’s session, including the command numbers, timestamps, and the actual commands. This command is useful for recalling and re-executing previous commands, as well as analyzing command usage patterns.