Unix Commands
Change the property file value using SED
-i To update file (if not provided it will just print the output
-E Use extended regex syntax
s Replace syntax would be s/orignalstring/replacement_string/
server.id is the string which will be searched for. To handle blanks use :blank
\1 String followed by it will be replaced
last parameter will be file name to process
Before running the command
server = orignal_value
sed -i -E 's/^(server[[:blank:]]*=[[:blank:]]*).*/\18/' foo.txt
After
server=8
If you want to pass the replacement value dynamically instead use single quite and value inside double quote ie. '"$newvalue"'
Epoch Time conversion
echo `date +%s`
converts date to epoch format
To find the size of all files in the directory
du -sh *
Delete all blank lines in files and store in new file
sed '/^$/d' xyz.cfg > abc.cfg
To Map a remote port to local port with SSH
ssh -i ~/Projects/kay -L 8999:127.0.0.1:80 user@remoteip
For multiple ports, you can use -D <port> user@ip - then configure network in browser to use the tunnelling at the port specified in ssh.