tar cf file.tar files
- create a tar named file.tar containing filestar xf file.tar
- extract the files from file.tartar czf file.tar.gz files
- create a tar with Gzip compressiontar xzf file.tar.gz
- extract a tar using Gzipgzip file
- compresses file and renames it to file.gzgzip -d file.gz
- decompresses file.gz back to file
Created
May 8, 2017 05:35
-
-
Save gregdeane/f4b7a073f9845a90d6bfb48543f0a3a3 to your computer and use it in GitHub Desktop.
Helpful Terminal Commands
ls
- list items in current directoryls -l
- list items in current directory and show in long format to see perimissions, size, and modification datels -a
- list all items in current directory, including hidden filesls -F
- list all items in current directory and show directories with a slash and executables with a starls dir
- list all items in directory dircd dir
- change directory to dircd ..
- go up one directorycd /
- go to the root directorycd ~
- go to to your home directorycd -
- go to the last directory you were just inpwd
- show present working directorymkdir dir
- make directory dirrm file
- remove filerm -r dir
- remove directory dir recursivelycp file1 file2
- copy file1 to file2cp -r dir1 dir2
- copy directory dir1 to dir2 recursivelymv file1 file2
- move (rename) file1 to file2ln -s file link
- create symbolic link to filetouch file
- create or update filefind file
- find all instances of file in real systemlocate file
- find all instances of file using indexed database built from the updatedb command. Much faster than find
grep pattern files
- search for pattern in filesgrep -r pattern dir
- search recursively for pattern in dirgrep -rn pattern dir
- search recursively for pattern in dir and show the line number foundgrep -r pattern dir --include='*.ext
- search recursively for pattern in dir and only search in files with .ext extensioncommand | grep pattern
- search for pattern in the output of commandcommand | grep -A 10 -B 10 pattern
- search for pattern in the output of command show 10 lines [A]fter and 10 lines [B]eforecommand | grep -C 10 pattern
- search for pattern in the output of command show 10 lines [A]fter and 10 lines [B]efore
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment