This page likely won't work without JavaScript enabled.bash snippets

bash snippets

The Linux Command Line

clear port 8080

sudo kill `sudo lsof -t -i:8080`

create soft symlink to d:/Github

ln -s ../../mnt/d/Github ./Github

ssh into server and move contents of /var/www/$FOLDERONE/$FOLDERTWO into a new folder inside backups

ssh -t ' FOLDERONE=staging; FOLDERTWO=portfolio; DATE=$(date +"%Y-%m-%d-%H:%M"); mkdir -p /var/www/$FOLDERONE/$FOLDERTWO/backups; mkdir /var/www/$FOLDERONE/$FOLDERTWO/backups/backup-$DATE; cd /var/www/$FOLDERONE/$FOLDERTWO/; mv $(ls /var/www/$FOLDERONE/$FOLDERTWO/ | grep -v '^backups$') /var/www/$FOLDERONE/$FOLDERTWO/backups/backup-$DATE; '

ssh into server and start a bash session

ssh -t 'cd /var/www/; ls; bash -l'

get absolute path to current dir

echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"

remove `\r` from end of all lines in myfile.txt

sed -i 's/\r$//' myfile.txt

`-i` means the file is edited in-place