Showing posts with label Linux Tricks. Show all posts
Showing posts with label Linux Tricks. Show all posts

20 Linux System Monitoring Tools Every SysAdmin Should Know


Need to monitor Linux server performance? Try these built-in command and afew add-on tools. Most Linux distributions are equipped with tons ofmonitoring. These tools provide metrics which can be used to get informationabout system activities. You can use these tools to find the possible causes ofa performance problem. The commands discussed below are some of the most basiccommands when it comes to system analysis and debugging server issues such as:
  1. Finding out bottlenecks.
  2. Disk (storage) bottlenecks.
  3. CPU and memory bottlenecks.
  4. Network bottlenecks.

#1: top - Process Activity Command

The top program provides a dynamic real-time view of arunning system i.e. actual process activity. By default, it displays the mostCPU-intensive tasks running on the server and updates the list every fiveseconds

Find duplicate files in Linux

Let’s say you have a folder with 5000 MP3 files you want to check for duplicates. Or a directory containing thousands of EPUB files, all with different names but you have a hunch some of them might be duplicates. You can cd your way in the console up to that particular folder and then do a
find -not -empty -type f -printf “%s\n” | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
This will output a list of files that are duplicates, according tot their HASH signature.
Another way is to install fdupes and do a
fdupes -r ./folder > duplicates_list.txt
The -r is for recursivity. Check the duplicates_list.txt afterwards in a text editor for a list of duplicate files

Monitor your changed files in real-time in Linux

Everybody knows top or htop. Ever wished there was something similar but to monitor your files instead of CPU usage and processes? Well, there is.
Run this:
watch -d -n 2 ‘df; ls -FlAt;’
and you’ll get to spy on which files are getting written on your system. Every time a file gets modified it will get highlighted for a second or so. The above command is useful when you grant someone SSH access to your box and wish to know exactly what they’re modifying.

Prevent Ubuntu from asking a password after resuming from Hibernate or Suspend

When you close the lid of your laptop and Ubuntu is running, the computer goes into Suspend mode. Same goes for chosing Hibernate from the shutdown menu, when the laptop goes into deep sleep and consumes less power. When resuming from these two states, Ubuntu will ask you for your password. If you’d like to get rid of this password field, you need to launch gconf-editor and navigate to apps > gnome-power-manager > lock. There you’ll find a checkbox for hibernate and one for suspend. Uncheck these and close the Configuration Editor. Next time you resume from Suspend and Hibernate, you won’t be prompted for a password.
You can still manually lock your screen before closing the lid by using Ctrl+Alt+L.