Linux Basics
- How do I check disk space in Linux?
Use df -h to see free space on mounted filesystems, and du -sh /path to see how much space a directory uses. - What is the difference between a process and a thread in Linux?
A process is an independent program with its own memory space; a thread is a lighter unit of execution within a process that shares memory with other threads. - How do I change file permissions in Linux?
Use the chmod command with either symbolic (u+rwx) or numeric (755) modes to change permissions for the owner, group, and others. - What is the difference between a hard link and a soft link?
A hard link is another name for the same file data (same inode); a soft link (symlink) is a separate file that points to a path. - How do I find a file by name in Linux?
Use find /path -name "filename" to search by name, or locate filename for a faster index-based search. - What does chmod 755 mean?
chmod 755 sets permissions so the owner can read, write, and execute; group and others can read and execute but not write. - How do I check which process is using a port on Linux?
Run sudo ss -tulpn to list listening ports and the process behind each one, or add grep for one port, such as sudo ss -tulpn | grep :8080. - How do I schedule a cron job on Linux?
Run crontab -e, add a line with five time fields followed by your command, and save. For example, 0 2 * * * runs the command every day at 2:00 a.m. - How do I view the last 100 lines of a log file?
Run tail with the -n option followed by the number of lines, such as tail -n 100 followed by the file path. Add -f to keep watching the file as new lines are written.