Unlock the Power of Your Terminal: Lesser-Known Linux Commands
Discover the final segment of our enlightening series on Lesser-Known Linux Commands! In this article, we round up ten practical commands that can significantly enhance your terminal efficiency. Whether you’re looking to check system information, manage processes, or troubleshoot network issues, these commands will elevate your Linux experience. Let’s dive in!
10 Essential Linux Commands to Master
42. lsb_release – Check Your Distro Info
The lsb_release
command reveals crucial information about your Linux distribution, such as version, ID, and codename. Use it as follows:
lsb_release -a
If lsb_release
is not installed, you can easily add it:
sudo apt install lsb-core # Debian/Ubuntu
sudo yum install redhat-lsb # RHEL/CentOS
Note: The -a
option displays complete distribution details.
43. nc -zv localhost 80 – Check If a Port Is Open
The nc
command (netcat) is invaluable for verifying whether a specific port is open:
nc -zv localhost 80
If successful, it indicates a web server is active:
Connection to localhost 80 port [tcp/http] succeeded!
44. curl ipinfo.io – Find Your Public IP & Location Info
If you need to find your public IP and location quickly, the curl
command is the way to go:
curl ipinfo.io
This will provide essential details, including your IP address and geographical location, which can be crucial for network troubleshooting.
45. Find Files Owned by a Specific User in a Directory
The find
command lets you locate files owned by a particular user:
find . -user root
Replace root
with any username to find their files.
46. sudo apt build-dep – Automatically Install Build Dependencies
Easily install the necessary packages for compiling software with:
sudo apt build-dep ffmpeg
This saves time and avoids the frustration of missing dependency errors during installation.
47. lsof -iTCP:80 -sTCP:LISTEN – Check What’s Running on a Port
To see what processes are using specific TCP ports, utilize:
lsof -iTCP:80 -sTCP:LISTEN
This command lists all services actively listening on port 80, providing insights into your web server setup.
48. find -size +100M – Find Large Files Easily
Identify large files that may be consuming disk space:
find . -size +100M
For ultra-large files, try:
find . -size +1000M
49. pdftk – Merge Multiple PDF Files Into One
Merge multiple PDF documents effortlessly using pdftk
, which you can install with:
sudo apt install pdftk
Combine files like so:
pdftk 1.pdf 2.pdf cat output merged.pdf
50. ps -LF -u – Check User Processes and Threads
To display all running processes and their threads for a specific user:
ps -LF -u ravi
51. Startx — :1 – Run Multiple Graphical Sessions
Utilize startx -- :1
to kick off a new graphical session without logging out of the current one—perfect for multitasking!
Use keyboard shortcuts like Ctrl + Alt + F7
to switch between sessions.
Conclusion
That concludes our series on Lesser-Known Linux Commands! We hope this collection of unique commands helps enhance your command-line capabilities. Have any hidden gems we didn’t mention? Feel free to share in the comments!
FAQ
Question 1: What are some common uses for the nc command?
The nc
command is often used for checking open ports, file transfers, and simple chat systems between computers.
Question 2: How do I find the largest files on my Linux system?
Use the find
command with the -size
option to target large files. Example: find . -size +1G
for files larger than 1GB.
Question 3: Can I manage multiple users in Linux?
Yes! Commands like startx
allow multiple graphical sessions, enabling seamless user management and multitasking.