Terminal Commands

mv /path/subfolder/{.,}* /path/
# copy files securely via ssh [remote -> local] (-r for recursive is applicable, -P for port)
scp -i test.pem ubuntu@hostname:/remote/location/path /destination/path

# copy files securely [local -> remote]
scp -i test.pem /destination/path ubuntu@hostname:/remote/location/path

 

# TAR

Compress

tar -czvf /tmp/destination.tar.gz -C [directory] [context_directory]

Example:

tar -czvf /tmp/destination.tar.gz -C /tmp/where_to_compress .

### Decompress / Extract

tar -xzvf /tmp/destination.tar.gz -C /tmp/where_to_extract .

Move all files including hidden to parent directory

 mv /path/subfolder/{.,}* /path/

JSON Manipulations

# converting json to ini string
echo $json_var | jq -r "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]"

Majd Arbash

...

Leave a Reply