Important Commands In Linux
Chapter:
Linux Commands
Last Updated:
24-08-2023 17:40:36 UTC
Program:
/* ............... START ............... */
Important commands in linux with examples
/* ............... END ............... */
Output
ls: List files and directories in the current directory.
Example: ls -l
cd: Change the current directory.
Example: cd /path/to/directory
pwd: Print the current working directory.
mkdir: Create a new directory.
Example: mkdir new_directory
rm: Remove files or directories.
Example: rm file.txt or rm -r directory
cp: Copy files or directories.
Example: cp file.txt /path/to/destination
mv: Move (rename) files or directories.
Example: mv old_file.txt new_file.txt or mv file.txt /new/directory
touch: Create an empty file.
Example: touch file.txt
cat: Display the contents of a file.
Example: cat file.txt
nano or vim: Text editors for creating or editing files.
Example: nano file.txt or vim file.txt
grep: Search for a pattern in files.
Example: grep "pattern" file.txt
chmod: Change file permissions.
Example: chmod 755 file.sh
chown: Change file ownership.
Example: chown user:group file.txt
ps: Display information about running processes.
Example: ps aux
top: Monitor system processes and resource usage.
kill: Terminate a process.
Example: kill process_id
df: Display disk space usage.
Example: df -h
du: Display file and directory space usage.
Example: du -h file.txt
wget: Download files from the web.
Example: wget https://example.com/file.txt
scp: Securely copy files between hosts over SSH.
Example: scp file.txt user@remote_host:/path/to/destination
ssh: Securely access a remote server.
Example: ssh user@remote_host
tar: Compress or extract files and directories.
Example: tar -cvf archive.tar files/ or tar -xvf archive.tar
apt-get or yum: Package managers for installing software on Debian-based or Red Hat-based systems, respectively.
Example: apt-get install package_name or yum install package_name
systemctl: Control system services (systemd).
Example: systemctl start service_name
ifconfig or ip: Network configuration and information.
Example: ifconfig or ip addr show
Remember to always refer to the manual pages for these commands using the man
command (e.g., man ls) to get detailed information about their options and usage.