Linux / Bash Flashcards
[your app/program] –version
returns the version of the program you have installed
touch [file name].[file type is optional]
creates that file in current directory
in vim:
i
enters INSERT mode where you can edit the file
in vim:
:wq
exits INSERT mode and saves the file changes
in vim:
:q
exits INSERT mode and does not save file changes
what kind of file is .md ?
markdown file
clear
clears the shell
CTRL L
clears the shell
CTRL D
logs out
open .
opens the current directory into a new graphical window (in Finder)
CTRL A
brings cursor to START of line
CTRL E
brings cursor to the END of line
CTRL U
delete LEFT of cursor
CTRL K
delete RIGHT of cursor
CTRL W
delete WORD on LEFT
CTRL Y
PASTE (after U, K, or W)
TAB
autocomplete
!!
REPEAT last command
CTRL Z
STOPS current command or process
ls
lists files in current directory
ls -all
lists all files in current directory with all permisions and all metadata
ls -a
lists all files and folders (even hidden ones)
ls [some directory]
lists files in specific directory
cd [some directory]
changes directory
cd /
goes to root directory
cd ..
goes up one folder
cd ../../../
goes up three folders
pwd
prints current working directory or path
man [some command]
explains the command and any options it might have
cat [file name]
shows the contents of a file
cat > [some filename]
opens up text editor to add text to that file, or create a new file it that name doesn’t exist
head [file name]
prints only the top lines (use “head -n #” where # is number of lines from top)
tail [file name]
prints only the last lines (use “tail -n #” where # is number of lines from bottom)
mkdir [file name]
creates a new folder
mkdir [1stFolder/2ndFolder/file name] ..
creates new folder in the specific path
cp [file] [newfilename]
copies and renames file
cp [file] [path]
copies a file to that path
cp -R [folder] [newFolder]
copies and renames a folder
cp *.txt somePath/
copies all files of that type to that folder
mv [file] somePath/
moves a file to a folder
mv [folder] [newFolder]
moves a folder inside another folder
mv [file name] [new file name]
renames a file
mv [folder name]
moves the folder up one in the hierarchy
rm [file]
deletes the file
rm -i [file]
asks for permission before deleting file