Basic File Operations
- ls: List directory contents.
ls
: List files in the current directory.ls -l
: List files in long format.ls -a
: List all files, including hidden files.
- cd: Change directory.
cd /path/to/directory
: Change to the specified directory.cd ~
: Change to the home directory.cd ..
: Move up one directory level.
- pwd: Print working directory.
pwd
: Display the current directory path.
- cp: Copy files or directories.
cp source destination
: Copy source to destination.cp -r source_directory destination_directory
: Recursively copy a directory.
- mv: Move or rename files or directories.
mv source destination
: Move or rename source to destination.
- rm: Remove files or directories.
rm file
: Remove the specified file.rm -r directory
: Recursively remove a directory and its contents.
- mkdir: Create a new directory.
mkdir directory_name
: Create a new directory with the specified name.
- rmdir: Remove an empty directory.
rmdir directory_name
: Remove the specified empty directory.
File Viewing and Editing
- cat: Concatenate and display file content.
cat file
: Display the content of the specified file.
- more: View file content one screen at a time.
more file
: Display the content of the specified file, one screen at a time.
- less: View file content with backward and forward navigation.
less file
: Display the content of the specified file with navigation capabilities.
- head: Display the first part of a file.
head file
: Display the first 10 lines of the specified file.head -n 20 file
: Display the first 20 lines.
- tail: Display the last part of a file.
tail file
: Display the last 10 lines of the specified file.tail -n 20 file
: Display the last 20 lines.tail -f file
: Follow the log file in real-time.
- nano: Text editor.
nano file
: Open the specified file in the nano text editor.
- vi/vim: Text editor.
vi file
: Open the specified file in the vi text editor.vim file
: Open the specified file in the vim text editor.
File Permissions
- chmod: Change file permissions.
chmod 755 file
: Set read, write, and execute permissions for the owner, and read and execute permissions for others.chmod u+x file
: Add execute permission for the owner.
- chown: Change file owner and group.
chown user:group file
: Change the owner and group of the specified file.
- chgrp: Change group ownership.
chgrp group file
: Change the group ownership of the specified file.
System Information
- uname: Print system information.
uname -a
: Print all system information.
- df: Display disk space usage.
df -h
: Display disk space usage in human-readable format.
- du: Display directory space usage.
du -h directory
: Display the disk usage of the specified directory in human-readable format.
- top: Display active processes.
top
: Display real-time information about system processes.
- ps: Display current processes.
ps aux
: Display detailed information about all running processes.
- free: Display memory usage.
free -h
: Display memory usage in human-readable format.
Networking
- ping: Send ICMP ECHO_REQUEST to network hosts.
ping hostname_or_IP
: Send ping requests to the specified host.
- ifconfig: Configure network interfaces.
ifconfig
: Display all network interfaces and their status.
- netstat: Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
netstat -tuln
: Display listening ports.
- ssh: OpenSSH SSH client (remote login program).
ssh user@hostname
: Connect to the specified host as the specified user.
- scp: Secure copy (remote file copy program).
scp source user@hostname:destination
: Copy files from local to remote.
- wget: The non-interactive network downloader.
wget URL
: Download files from the specified URL.
Package Management (Debian-based systems)
- apt-get: APT package handling utility.
apt-get update
: Update package list.apt-get upgrade
: Upgrade all packages.apt-get install package_name
: Install the specified package.
User Management
- adduser: Add a user to the system.
adduser username
: Add a new user with the specified username.
- passwd: Change user password.
passwd username
: Change the password for the specified user.
- usermod: Modify a user account.
usermod -aG group username
: Add the specified user to the specified group.
Miscellaneous
- man: Display the manual for a command.
man command
: Show the manual for the specified command.
- echo: Display a line of text.
echo "text"
: Print the specified text to the terminal.
- history: Display the command history.
history
: Show the list of previously executed commands.
- alias: Create an alias for a command.
alias name='command'
: Create an alias namedname
for the specified command.
This is not an exhaustive list, but it covers many of the essential Linux commands used for everyday tasks. For more detailed information, refer to the man pages or specific command documentation.
Cyber Security graduate from Edith Cowan University, Australia, equipped with a strong foundation in Linux systems and a passion for cybersecurity. As an enthusiast for both open-source technologies and security practices.