Linux Move Folder Contents To Another Directory mv -vn foldername/* /path_to_folder/foldername -v: verbose -n: dont overwrite file if file already exists
Programming, Security and Tech (and Code Snippets)
Linux Command To Sort du -h By File Size A quick command to sort du -h by file size using perl. du -h | perl -e ‘sub h{%h=(K=>10,M=>20,G=>30);($n,$u)=shift=~/([0-9.]+)(\D)/; return $n*2**$h{$u}}print sort{h($b)<=>h($a)}<>;’ Output will be like so 4.6M . 3.8M ./folder1…
PHP Check If A Linux Command Is Valid Sometimes, you might end up using the linux terminal via PHP, and it is good practise for you to perform checks before executing commands. Here’s how you can check if a command…
Linux Run SCP command in background Here is how you can keep the SCP command running even after closing the remote shell (e.g Putty) Keep Process In Background Open ssh terminal to remote server. Type your scp command as normal Background the…
Linux Check SSH Login Attempts To Server For CentOS or RHEL distros, the login attempts are stored at /var/log/secure For Ubuntu, the login attempts are stored at /var/log/auth.log Sample Commands (based on CentOS) To read the file, simply run the…