Certainly! Here’s an extended list of 100 useful command lines in Linux for newcomers:
File and Directory Operations
ls
: List files and directories in the current location.ls -l
: List files and directories in long format.ls -a
: List all files and directories, including hidden ones.cd
: Change directory.cd ..
: Go up one directory level.pwd
: Print the current working directory.mkdir directory_name
: Create a new directory.rm file_name
: Remove a file.rm -r directory_name
: Remove a directory and its contents recursively.cp source_file destination_file
: Copy a file.cp -r source_directory destination_directory
: Copy a directory and its contents recursively.mv source_file destination_file
: Move or rename a file.mv directory_name destination_directory
: Move a directory.cat file_name
: Display the contents of a file.less file_name
: View the contents of a file interactively.head file_name
: Display the first few lines of a file.tail file_name
: Display the last few lines of a file.grep pattern file_name
: Search for a pattern in a file.find directory -name file_name
: Search for files in a directory based on their names.chmod permissions file_name
: Change permissions of a file.chmod -R permissions directory_name
: Change permissions recursively for a directory and its contents.chown user_name file_name
: Change the owner of a file.chown -R user_name directory_name
: Change the owner recursively for a directory and its contents.tar -czvf archive_name.tar.gz directory_name
: Create a compressed archive of a directory.tar -xzvf archive_name.tar.gz
: Extract files from a compressed archive.
Text Processing
echo "text"
: Print text to the console.echo $variable
: Print the value of a variable.wc file_name
: Count the number of lines, words, and characters in a file.sort file_name
: Sort lines in a file alphabetically.uniq file_name
: Remove adjacent duplicate lines from a sorted file.cut -d delimiter -f field file_name
: Extract specific fields from a delimited file.head -n N file_name
: Display the first N lines of a file.tail -n N file_name
: Display the last N lines of a file.sed 's/old_text/new_text/' file_name
: Replace occurrences of old_text with new_text in a file.awk '{print $1}' file_name
: Print the first column of a file using the AWK command.grep pattern file_name
: Search for a pattern in a file.grep -r pattern directory_name
: Search for a pattern recursively in files within a directory.diff file1 file2
: Show the differences between two files.paste file1 file2
: Merge lines from two files side by side.
File Permissions
ls -l
: List files and directories with detailed permissions.chmod permissions file_name
: Change permissions of a file.chmod -R permissions directory_name
: Change permissions recursively for a directory and its contents.chown user_name file_name
: Change the owner of a file.chown -R user_name directory_name
: Change the owner recursively for a directory and its contents.
Networking
ping host
: Send ICMP echo requests to a host.wget url
: Download a file from the web.curl url
: Retrieve the content of a URL.ifconfig
: Display network interface information.ip addr show
: Display IP address information.netstat
: Display network connections and statistics.ssh user@host
: Connect to a remote server using SSH.
System Information
uname -a
: Display system information.uptime
: Show system uptime.whoami
: Display the current user.who
: Display currently logged-in users.df
: Show disk space usage of file systems.du -sh directory_name
: Estimate the disk usage of a directory.free
: Display memory usage.top
: Display real-time system resource usage.ps
: Show running processes.kill process_id
: Terminate a process.
Compression and Archiving
gzip file_name
: Compress a file using gzip.gunzip file_name
: Decompress a gzip-compressed file.tar -czvf archive_name.tar.gz directory_name
: Create a compressed tar archive.tar -xzvf archive_name.tar.gz
: Extract files from a tar archive.
Package Management
apt update
: Update package lists.apt upgrade
: Upgrade installed packages.apt install package_name
: Install a package.apt remove package_name
: Remove a package.apt search package_name
: Search for a package.apt show package_name
: Display information about a package.
Process Management
ps
: Show running processes.top
: Display real-time system resource usage.kill process_id
: Terminate a process.killall process_name
: Terminate all instances of a process.
User and Group Management
useradd username
: Create a new user.userdel username
: Delete a user.passwd username
: Change the password for a user.groupadd groupname
: Create a new group.groupdel groupname
: Delete a group.usermod -aG groupname username
: Add a user to a group.
System Maintenance
reboot
: Reboot the system.shutdown
: Shut down the system.sudo command
: Run a command with administrative privileges.history
: View command history.clear
: Clear the terminal screen.
File Transfer (FTP)
ftp host
: Connect to an FTP server.get file_name
: Download a file from the FTP server.put file_name
: Upload a file to the FTP server.ls
: List files and directories on the FTP server.
Miscellaneous
date
: Display the current date and time.cal
: Display a calendar.watch command
: Execute a command repeatedly and display the output in real-time.man command
: Display the manual page of a command.history
: View command history.clear
: Clear the terminal screen.exit
: Exit the current shell.alias name="command"
: Create an alias for a command.echo $PATH
: Display the value of the PATH environment variable.Ctrl+C
: Interrupt the currently running command.
These commands cover a wide range of tasks and should help you navigate the Linux command line effectively. Remember to refer to the
manual pages (man
command) for more detailed information on specific commands and their options.