1. How do you find files based on specific criteria using the find command?
The find command is a powerful tool for locating files and directories based on attributes like name, size, and modification time.
find /path/to/search -name "*.log" -size +10M -mtime -7This example searches for log files larger than 10MB modified within the last 7 days.
2. How do you search for a specific pattern in files using grep?
grep scans files for lines matching a given pattern, using regular expressions for flexible matching.
grep -r "error" /var/log/This recursively searches for the word “error” in all files under /var/log.
3. How do you monitor real-time logs using tail?
tail displays the last few lines of a file. The -f option keeps the output open for real-time updates.
tail -f /var/log/syslogUseful for monitoring system logs as new entries are added.
4. How do you display disk usage using df?
df reports the amount of disk space used and available on mounted file systems.
df -hThe -h flag shows sizes in human-readable format (e.g., MB, GB).
5. How do you check memory usage using free?
free displays system memory usage, including total, used, and available RAM and swap.
free -hThe -h option makes the output easier to read.
6. How do you compress files using tar?
tar is used to archive and compress files or directories into a single file.
tar -czvf archive.tar.gz /path/to/directoryThis creates a compressed .tar.gz archive of the specified directory.
7. How do you extract files from a tarball using tar?
tar can also be used to extract files from an archive.
tar -xzvf archive.tar.gzThis decompresses and extracts the contents of the archive.
8. How do you check running processes using ps?
ps lists currently running processes along with details like PID, CPU usage, and memory.
ps auxThe aux options show all processes for all users in full detail.
9. How do you monitor system performance using top?
top provides a dynamic, real-time view of system resource usage, including CPU, memory, and running processes.
topUseful for identifying performance bottlenecks and high-resource tasks.
10. How do you kill a process using kill?
kill terminates a process using its Process ID (PID). The -9 option forces termination.
kill -9 PIDReplace PID with the actual process ID you want to stop.
11. How do you manage services using systemctl?
systemctl is used to control system services in systems using systemd.
systemctl restart nginxThis restarts the nginx web server. You can also use start, stop, or status.
12. How do you change file permissions using chmod?
chmod modifies the read, write, and execute permissions of files and directories.
chmod 755 script.shThis gives full permissions to the owner and read-execute to others.
13. How do you change file ownership using chown?
chown changes the owner and group of a file or directory.
chown user:group file.txtReplace user and group with the desired owner and group names.
14. How do you create symbolic links using ln?
ln creates links to files or directories. The -s option creates symbolic (soft) links.
ln -s /path/to/original /path/to/linkSymbolic links act as shortcuts to the original file or directory.
15. How do you schedule tasks using crontab?
crontab allows users to schedule recurring tasks using cron syntax.
crontab -eThis opens the cron table for editing. You can define jobs like 0 9 * * * /path/to/script.sh to run daily at 9 AM.
Search
Categories
Recent Posts
Top 10 Free Audio Generation AI Tools in 2025
Top 10 Free Video Generation AI Tools in 2025
Top 10 Free Image Generation AI Tools in 2025
Top 10 Free Text-Based AI Tools in 2025
Top Git interview Questions for Experienced Developer
Recent Tags