Basic Linux Terminal Commands
Below is a comprehensive list of commonly used basic commands in the Linux terminal. These commands are essential for managing the system, interacting with files, and performing various tasks through the command-line interface.
Navigation
pwd
: Display the current working directory.ls
: List files and directories in the current directory.ls -l
: Display file/directory information in long format.ls -a
: Display all files/directories, including hidden ones.
cd
: Change directory.cd [directory_name]
: Move to the specified directory.cd ..
: Move to the parent directory.cd ~
: Move to the user’s home directory.
mkdir
: Create a new directory.mkdir [directory_name]
: Create a directory with a specific name.
Files and Directories
touch
: Create an empty file. -touch [file_name]
: Create a file with a specific name.cp
: Copy files/directories.cp [source] [destination]
: Copy source to destination.
mv
: Move or rename files/directories.mv [source] [destination]
: Move source to destination.mv [old_name] [new_name]
: Rename a file/directory.
rm
: Delete files/directories.rm [file_name]
: Delete a file with a specific name.rm -r [directory_name]
: Delete a directory and its contents recursively.
cat
: Display the contents of a file in the terminal.cat [file_name]
: Display the contents of a specific file.
Text File Manipulation
nano
orvim
: Edit text files in the terminal.echo
: Display text in the terminal or save it to a file.echo [text]
: Display text in the terminal.echo [text] > [file_name]
: Save text to a file (overwrite content).echo [text] >> [file_name]
: Append text to a file (without overwriting).
System Information
uname
: Display information about the system.uname -a
: Display detailed system information.
top
: Display a list of running processes.free
: Display memory usage.df
: Display disk space usage information.
User and Permission Management
sudo
: Execute commands as a superuser (root).useradd
: Add a new user.passwd
: Change a user’s password.chmod
: Change file/directory permissions.chown
: Change file/directory ownership.
Networking
ping
: Send ICMP echo packets to a network address.ping [ip_address]
: Send ping packets to an IP address.
ifconfig
orip
: Display network interface information.ssh
: Access a remote machine using Secure Shell (SSH).ssh [username]@[ip_address]
: Connect to a remote machine.