Skip to content

Instantly share code, notes, and snippets.

@aidancasey
Last active March 9, 2016 15:29
Show Gist options
  • Save aidancasey/074670dde999abd5e4f3 to your computer and use it in GitHub Desktop.
Save aidancasey/074670dde999abd5e4f3 to your computer and use it in GitHub Desktop.
Linux CLI tips and tricks
> pwd
Print working Directory
> env
Print environment variables
> env | less
Pipes environment variables to less text editor (type 'q' to quit)
> echo hello world
prints output to bash window
>bash
opens a child bash window inside your bash window
> export myval
Makes local bash variable myval availble to all bash windows
>man wget
displays manual ( help file) for a program
>type wget
tells you the program that is associated with a command
>locate deepping
quickest way to find all files and foldes with the name deepping.
to find files added very recently you may need to update the index so run "sudo updatedb" and then try
> cat /etc/group | grep mysql >>foo.txt
read the file etc/group, pipe to the output, search it (grep) for the lines that contain the string 'mysql' and output them to a new file called foo.txt
> head /etc/group
print first 10 lines of the file
> tail /etc/group
print last 10 lines of the file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment