Sometimes a Proxmox KVM VM will stop responding to the GUI’s attempts to shut it down; fortunately it’s easy to shut it down from the command line. Make note of the VM ID (next to the name of the VM in the left pane of the Proxmox GUI), log into the server via SSH…
Another awk question. How to remove everything after the first word in each line? E.g., if we wanted to remove everything but the names in this input (FILENAME.txt): Anna 123 09123 Main Street Bob 109 09800 Smith Street Joe 0981 123123 King Street We can use awk like so: awk ‘{…
Short and sweet – when piping data through awk, how do we remove the first line of the input? awk ‘{if (NR!=1) {print}}’ e.g. cat FILENAME.txt | awk ‘{if (NR!=1) {print}}’ Done!
This is an interesting one – if you have the need to monitor your CPU usage individually across cores it’s actually quite easy with the top command. Simply run top and hit “1” – your output will go from: to: In this case the server is a hexcore (0-5 cores shown, 6…
Knowing how to limit how long a process will run for is quite useful, particularly when you have daily backup scripts and the like which may at times run more than 24 hours; having multiple processes attempting to synchronize the same files can waste time, bandwidth and CPU power needlessly. The command we will…
If you’re writing scripts or making cron jobs you will need to know the full path of the commands you’re using; rather than just being able to use “ls” you would have to use “/bin/ls” instead. You could use the find command here but there’s a quicker and more elegant way: which. Use it…
Sometimes you may wish to clear the terminal window, whether it be to hide what you’ve just done, clear some irrelevant/distracting output or any other reason. The best command to do this is simple: reset This completely clears the output shown in your terminal window but doesn’t log you out. If you…
Sometimes you may wish to further filter grep output, such as in the following situation: # zfs get all | grep compressratio backup01 compressratio 1.23x – backup01 refcompressratio 1.00x – backup01/data compressratio 1.50x – backup01/data refcompressratio 1.50x – backup01/photos compressratio 1.05x – backup01/photos refcompressratio 1.05x – Here we only really want to see…
If you’re listing the contents of a directory using the “ls -l” command in a terminal window you may find that the number of results cause pages of text to fly past your screen, leaving you with only the last page to look at. If you aren’t using a terminal which you can scroll back…