0% found this document useful (0 votes)
6 views

Linux Commands

Uploaded by

yogi datapro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Linux Commands

Uploaded by

yogi datapro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

### Basic Commands

1. **`pwd`**: Print Working Directory. Shows the current directory.

2. **`ls`**: List files and directories.

3. **`cd`**: Change Directory.

4. **`cp`**: Copy files or directories.

5. **`mv`**: Move or rename files or directories.

6. **`rm`**: Remove files or directories.

7. **`mkdir`**: Make Directory.

8. **`rmdir`**: Remove Directory (empty).

9. **`touch`**: Create an empty file or update a file's timestamp.

10. **`cat`**: Concatenate and display file content.

11. **`echo`**: Display text or variable values.


### File Commands
1. **`file`**: Determines file type.
- Example: `file file1.txt`
2. **`chmod`**: Change file permissions.
- Example: `chmod 755 file1.txt`
3. **`chown`**: Change file owner and group.
- Example: `chown user1 file1.txt`
4. **`ln`**: Create hard or symbolic links.
- Example: `ln -s file1.txt link1.txt` (symbolic link)
5. **`diff`**: Compare files line by line.
- Example: `diff file1.txt file2.txt
6. **`tar`**: Archive files.
- Example: `tar -cvf archive.tar file1.txt`, `tar -xvf archive.tar
7. **`gzip`**: Compress files.
- Example: `gzip file1.txt`
8. **`gunzip`**: Decompress files.
- Example: `gunzip file1.txt.gz`
9. **`zip`**: Create a zip archive.
- Example: `zip archive.zip file1.txt`
10. **`unzip`**: Extract zip archive.
- Example: `unzip archive.zip`

### System Commands


1. **`top`**: Display real-time system processes.
- Example: `top`
2. **`ps`**: List running processes.
- Example: `ps aux`
3. **`kill`**: Terminate processes.
- Example: `kill 1234`
4. **`pkill`**: Kill processes by name.
- Example: `pkill firefox`
5. **`systemctl`**: Manage system services.
- Example: `systemctl status apache2`, `systemctl start apache2`
6. **`service`**: Manage system services (older command).
- Example: `service apache2 status`
7. **`reboot`**: Restart the system.
- Example: `reboot`
8. **`shutdown`**: Shut down or restart the system.
- Example: `shutdown now`, `shutdown -r now` (restart)
9. **`df`**: Display disk space usage.
- Example: `df -h`
10. **`du`**: Disk usage of files and directories.
- Example: `du -sh /home/user/`
### Network Commands
1. **`ifconfig`**: Display or configure network interfaces (deprecated, replaced by
`ip`).
- Example: `ifconfig`
2. **`ip`**: Network interface configuration.
- Example: `ip addr show`, `ip link set eth0 up`
3. **`ping`**: Check connectivity to a host.
- Example: `ping google.com`
4. **`traceroute`**: Trace the route packets take to a network host.
- Example: `traceroute google.com`
5. **`netstat`**: Network statistics and connections.
- Example: `netstat -tuln`
6. **`ss`**: Utility to investigate sockets.
- Example: `ss -tuln`
7. **`curl`**: Transfer data from or to a server.
- Example: `curl http://example.com`
8. **`wget`**: Download files from the web.
- Example: `wget http://example.com/file.zip`
9. **`nmap`**: Network exploration and security auditing.
- Example: `nmap 192.168.1.1`
10. **`iptables`**: Configure network packet filtering rules.
- Example: `iptables -L` (list rules)

### Other Useful Commands


1. **`history`**: Show command history.
- Example: `history`
2. **`alias`**: Create shortcuts for commands.
- Example: `alias ll='ls -l'`
3. **`unalias`**: Remove aliases.
- Example: `unalias ll`
4. **`basename`**: Strip directory and suffix from filenames.
- Example: `basename /home/user/file1.txt`
5. **`dirname`**: Strip the last component from the file name.
- Example: `dirname /home/user/file1.txt`
6. **`date`**: Display or set the system date and time.
- Example: `date`, `date '+%Y-%m-%d %H:%M:%S'`
7. **`uptime`**: Show how long the system has been running.
- Example: `uptime`
8. **`whoami`**: Show the current user.
- Example: `whoami`
9. **`sudo`**: Execute a command as another user (usually root).
- Example: `sudo ls /root`
10. **`man`**: Manual pages for commands.
- Example: `man man`
### Additional File Management Commands###########################
2. **`tree`**: Display directory contents in a tree-like format.
- Example: `tree /home/user/`
3. **`wc`**: Count words, lines, and characters in files.
- Example: `wc -l file1.txt` (count lines in file1.txt)
### Additional Network Commands
2. **`nmap`**: Network exploration and security auditing.
- Example: `nmap -sP 192.168.1.0/24` (ping scan a subnet)
4. **`iwconfig`**: Configure wireless network interfaces.
- Example: `iwconfig wlan0`
5. **`host`**: DNS lookup utility.
- Example: `host google.com`
6. **`dig`**: DNS lookup and query utility.
- Example: `dig google.com`

### Additional Miscellaneous Commands


1. **`grep`**: Search for text patterns in files.
- Example: `grep "pattern" file1.txt`
6. **`bash`**: Start a new Bash shell session.
- Example: `bash`
7. **`sh`**: Start a new Bourne shell session.
- Example: `sh`
9. **`sort`**: Sort lines of text files.
- Example: `sort file1.txt`

You might also like