This is an old revision of the document!
Basic commands to move around in UNIX.
Move a File: mv filename directorypath
copy a file: cp filename directorypath
rename a file: mv filename newfilename
compression notes :
to do a zip extract: “unzip filename.zip” (files within should come out exported to the current directory.)
Tar is an archive format that can do .tar, .tar.gz, .tar.bz2, and .tar.xz
Extract .tar: tar -xvf file.tar
Extract .tar.gz: tar -xzvf file.tar.gz
Extract .tar.bz2: tar -xjvf file.tar.bz2
Extract .tar.xz: tar -xJvf file.tar.xz (Doing a J instead of j will signal its a .xz end.)
To create any .tar file compression: tar -cvf file.tar(add .gz, .bz2, .xz) /file directory to encapsulate
What the letters mean in before the file export.
- x means to extract a tar file
- v means show progress while extracting
- f means specify an archive/file
- j extract a .bz2 file
- J extract a .xz file
- decompress files of a .gz extension
Variables
Set the variable: t=“what” (so it saves)
Execute and see it: echo “$t” (should say what t was set to)
Text Manipulation
Rev command (Reverses text in a file): rev filename > exportedfile
Tac Command (flips the text from up to down. Usually helps if your document looks upside down)
tac: tac filename > exportfilename
Wild Cards
Symbols that represent different symbols.
Wild card symbols
- * - Kleene Star; match 0 or more symbols.
- ? - Match 1 of any symbol
- [] - Character class; match 1 of any of enclosed symbols.
- [^]- Inverted character class; do not match 1 of any of enclosed symbols.