Some useful apps:

  • ranger – file browser
  • mc – file browser
  • youtube-dl – YouTube downloader
  • ncdu – disk usage
  • neofetch – sys info
  • hollywood – just for fun
  • cmatrix – just for fun
  • tmux – terminal multiplexer
  • fzf – fuzzy finder
  • calcurse – calendar

*. cygwin, switch path
cd /cygdrive/C/…

*. ssh connect
ssh -i key.pem user@address
ssh -i key.pem ubuntu@
ssh -l admin

*. upload/download file via ssh
scp -i key.pem user@address:path
scp -i key.pem .
scp -i key.pem ubuntu@
scp -i key.pem ubuntu@ .

*. create ssh access with a public/private key
test -f ~/.ssh/ || ssh-keygen -t rsa #press enter twice if given prompts, then “ssh-add”
scp ~/.ssh/ admin@ #type password
ssh admin@ #type password
cat /tmp/ >> ~/.ssh/authorized_keys
rm /tmp/

*. find file
find . -name testfile.txt
find /home -name *.jpg

*. Apache logs (Ubuntu):
tail -f /var/log/apache2/access.log
tail /var/log/apache2/access.log
tail /var/log/apache2/error.log

*. create fetch file in dcmimport folder:
for i in *; do touch FETCHI$i.SEM; done

*. Finding the Top 5 Big Files
find . -type f -exec ls -s {} \; | sort -n -r | head -5

*. How to create a compressed tar.gz file from multiple files and folders in Linux?
tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2
tar -xzf tar-file-name.tar.gz

*. check free space
df -h

*. folder size
du -hs /path/to/folder
du -h –max-depth=1 /path/to/folder
du –max-depth=1 /path/to/folder | sort -nk1
du -hsc *

*. delete directory
rm -rf dir

*. find file older then 100 days
find . -mtime +100

*. delete files older then 100 days
find . -mtime +100 -exec rm {} \;

*. recursive user of grep
grep -r “string” /some/path

* restart mysql
sudo service mysql restart

* start mysql
mysql -u root -p
mysql> use database;

* restart apache
sudo /etc/init.d/apache restart

* check listening port
sudo netstat -nap | grep :5000 | grep LISTEN

* git on NAS stogare
– on the server (via ssh):
git init –bare Project_1.git

– on a client:
cd /cygdrive/D/Projects/
git config –list
git clone admin@nas_address:/share/git/Project_1.git
git status
git add …
git commit -m “…”
git push
git pull

some useful tips (mostly for myself)