Skip to content

Instantly share code, notes, and snippets.

@johanlaidlaw
Created September 19, 2012 19:39
Show Gist options
  • Save johanlaidlaw/3751757 to your computer and use it in GitHub Desktop.
Save johanlaidlaw/3751757 to your computer and use it in GitHub Desktop.
Useful linux commands that I never can remember
#Create ssh keys
ssh-keygen -t rsa -C "bob@bob.com" -f id_rsa.MyService
#Empty a file (owned by you)
> file.log
#Empty a file owned by root
#Copy a file from server over ssh
scp username@server.com:myfile.log myfile.log
#Get every nth line of a file (get line 1 and then take every 3rd line)
sed -n '1~3p' myfile.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment