Blockchain Council

With 15 years of experience as a Linux System Administrator, I have developed a deep passion for harnessing the power of open-source technologies to build robust, secure, and scalable IT infrastructures. My love for working with the command line has been a driving force throughout my career, empowering me to efficiently manage and troubleshoot systems. My extensive hands-on experience with various Linux distributions, such as Red Hat, CentOS, Ubuntu, and Debian, coupled with my expertise in system administration tools like Bash scripting, Ansible, Puppet, Docker, and Kubernetes, has enabled me to consistently deliver high-performance solutions. I take pride in my ability to proactively identify and resolve system issues, optimize server performance, and ensure maximum uptime for critical applications. As a strong collaborator and communicator, I effectively bridge the gap between technical and non-technical stakeholders, translating complex concepts into easily digestible terms. With a constant drive to stay at the forefront of industry trends and best practices, I am excited to bring my expertise and enthusiasm to new challenges and contribute to the success of forward-thinking organizations.

Learning the essential Linux commands is crucial for anyone starting their journey with this powerful operating system. In this article, we’ll explore 25 common Linux commands that every beginner should know to navigate, manage, and manipulate files and directories effectively in the command-line interface.

CommandDescriptionExample 1Example 2Example 3
lsList files and directoriesls (lists files in current directory)ls -l (lists files with details)ls /path/to/directory (lists files in specified directory)
cdChange directorycd /path/to/directory(changes to specified directory)cd .. (moves up one directory level)cd ~ (changes to home directory)
pwdPrint working directorypwd (displays the current working directory)pwd /path/to/directory (displays the specified directory path)pwd -P (displays the resolved path without symbolic links)
mkdirMake a new directorymkdir directory_name (creates a new directory)mkdir -p /path/to/new/directory(creates nested directories)mkdir -m 700 private_directory (creates a directory with specific permissions)
rmdirRemove an empty directoryrmdir directory_name(removes the specified empty directory)rmdir -p /path/to/nested/directory (removes nested empty directories)rmdir -v directory_name(removes directory with verbose output)
cpCopy files and directoriescp source_file destination(copies a file)cp -r source_directory destination (copies a directory recursively)cp -i *.txt backup/ (copies text files with confirmation for overwriting)
mvMove or rename files and directoriesmv source destination (moves a file/directory)mv old_name new_name (renames a file/directory)mv -i *.txt backup/ (moves text files with confirmation for overwriting)
rmRemove files and directoriesrm file_name (removes a file)rm -r directory_name (removes a directory recursively)rm -i *.txt (removes text files with confirmation)
catDisplay file contentscat file_name (displays the contents of a file)cat file1.txt file2.txt(concatenates and displays multiple files)cat > new_file.txt (creates a new file and allows input from the terminal)
lessView file contents one page at a timeless file_name (opens the file for viewing)less +F file_name (opens the file and automatically exits at the end)less -N file_name (displays line numbers)
headDisplay the first few lines of a filehead file_name (displays the first 10 lines)head -n 20 file_name (displays the first 20 lines)head -c 100 file_name(displays the first 100 bytes)
tailDisplay the last few lines of a filetail file_name (displays the last 10 lines)tail -n 20 file_name (displays the last 20 lines)tail -f log_file.txt(displays the last lines and follows the file as it grows)
grepSearch for a pattern in filesgrep pattern file_name(searches for a pattern in a file)grep -i pattern file_name (case-insensitive search)grep -r pattern directory(recursive search in a directory)
findSearch for files in a directory hierarchyfind /path/to/directory -name file_pattern (finds files matching the pattern)find . -type d -empty (finds empty directories in the current directory tree)find /path -size +1G (finds files larger than 1GB)
manDisplay the user manual for a commandman ls (displays the manual page for the ls command)man -k keyword (searches for manual pages containing the keyword)man 7 overview (displays the manual page with section number 7)
echoPrint text to the terminalecho "Hello, World!" (prints the text to the terminal)echo $PATH (prints the value of the PATH environment variable)echo "Text" > file.txt(redirects the output to a file)
chmodChange file permissionschmod +x file_name (makes a file executable)chmod 644 file_name (sets read/write permissions for owner, read for others)chmod -R 755 directory(changes permissions recursively in a directory)
sudoExecute a command as the superusersudo command (runs the command with superuser privileges)sudo -u username command (runs the command as a specific user)sudo -i (starts an interactive root shell)
apt or yumPackage managementapt update (updates package lists)apt install package_name (installs a package)apt remove package_name(removes a package)
sshSecure Shell for remote loginssh username@remote_host(connects to a remote host over SSH)ssh -p 2222 username@remote_host(connects to a remote host on a specific port)ssh -X username@remote_host (enables X11 forwarding for GUI applications)
topDisplay system resource usagetop (shows real-time system resource usage)top -o %CPU (sorts processes by CPU usage)top -u username (shows processes of a specific user)
psList running processesps (lists current user’s processes)ps aux (lists all processes)`ps -ef
killStop a running processkill process_id (stops the process with the specified ID)kill -9 process_id (forcefully terminates the process)killall process_name (stops all processes with the specified name)
tarArchive and compress filestar -czf archive.tar.gz directory (creates a compressed archive)tar -xzf archive.tar.gz (extracts a compressed archive)tar -xzf archive.tar.gz -C /path/to/directory (extracts to a specific directory)
wgetDownload files from the webwget the specified file)wget -c a partially downloaded file)
LEGO Brand Retail