#linuxtips — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #linuxtips, aggregated by home.social.
-
🤔 Did you know you can query more specific details about active connections on Linux?
With 'ss' you can show active connections and filter them by port number. Especially on a web server this might come in handy to see how many connections there are.
Why use this? Could be useful for troubleshooting systems under heavy load, but also to improve your system monitoring or do trend analysis.
Do you have any good 'ss' commands to share?
-
🤔 So what process is listening on a particular port?
On Linux there are a few options, like using lsof (list open files) and fuser.
For example with fuser: fuser 443/tcp
Another great option is using the 'ss' command'.
Do you have another tool that easily shows this information?
-
🔎 You already know which directory takes up a lot of disk space and want to clean out? With 'find' you you can search for files bigger than a specific size.
⚠️ The size option of find is different for #OpenBSD, #FreeBSD, and others.
find / -size +10000000c
💡 In my Linux example I used mebibytes. Yes, that silly name thing where we sometimes use 1000 and sometimes binary 2^10 (1024).
-
Got a file, but only interested in the last part? Then you can 'tail'
🤔 But what if you want to reverse a full file or a part of it?
🤝 Meet 'tac', yes, the reverse of 'cat'
Combine it with tail to only show the last part of a file, then pipe it through tac to reverse it.
-
🤔 When looking at log and data files it can be hard to spot the exceptional events.
🧰 A great tool to give color to boring screen output is 'grc'.
📖 Run it in front of the command that you would normally run and it will add colors.
Cool tool, right? 🔁
(note: for this output I had to adjust the colors manually, they look better in the terminal)
-
With the help of the lsusb command you can see which USB devices are connected to your system. Very useful to confirm that a device is plugged in and recognized, but also to block devices using udev.
Example: I wanted to block the microphone of my webcam, so it only is used for the video.
Steps:
- Find USB device identifier
- Create udev rule
- Reload udev daemon -
🧠 Did you know?
You can run the top command in "batch mode" and have it stop after gathering information once.
Great for getting information and sorting it, for example by processes consuming the most memory.
Could be a useful alias if you need it more than once.
This also works for the BSDs, but with slightly different options.
Would you like more of these tips? 🔁
-
Como é um DATA CENTER por dentro? Por dentro da INTERNET!