mirror of
https://github.com/cheat/cheat.git
synced 2024-11-22 22:11:35 +01:00
Fixed cheat sheets to conform to the standard style more closely
This commit is contained in:
parent
aa9403d432
commit
e5bf9146fe
@ -1,11 +1,5 @@
|
|||||||
# alias - Creates an alias of a command
|
# Show a list of your current shell aliases
|
||||||
*Stick these in your .bashrc/.bash_profile for permenant use, otherwise lost on re-entry
|
alias
|
||||||
|
|
||||||
|
# Map `ll` to `ls -l` (Can be used per session or put inside a shell config file)
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
alias lll='ls -al'
|
|
||||||
alias vi='vim'
|
|
||||||
alias ..='cd ..'
|
|
||||||
alias c='clear'
|
|
||||||
alias rkhunter='rkhunter --versioncheck --update --autox --skip-keypress --check'
|
|
||||||
|
|
||||||
Running just `alias' will show your current aliases.
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
# cat - concatenate and print files
|
# Display the contents of a file
|
||||||
cat [-benstuv] [filename]
|
cat /path/to/foo
|
||||||
|
|
||||||
-b : Number non blank lines (1 indexed)
|
# Display contents with line numbers
|
||||||
-e : Display non printing chars
|
cat -n /path/to/foo
|
||||||
-n : Number output (1 indexed)
|
|
||||||
-s : Single spaced output
|
# Display contents with line numbers (blank lines excluded)
|
||||||
-t : Display non printing chars (Tab as `^I')
|
cat -b /path/to/foo
|
||||||
-u : Disable output buffering
|
|
||||||
-v : Display all non printing chars no matter what
|
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
# cp - copy. Copies a file or directory
|
# Create a copy of a file
|
||||||
cp [-a, -f, -H, -i, -L, -n, -p, -P, -R, -X] [-v] [source] [target]
|
cp ~/Desktop/foo.txt ~/Downloads/foo.txt
|
||||||
|
|
||||||
-a : Same as -pPR
|
# Create a copy of a directory
|
||||||
-f : Force
|
cp -r ~/Desktop/cruise_pics/ ~/Pictures/
|
||||||
-H : Follow sym links
|
|
||||||
-i : Prompt before overwrite
|
# Create a copy but ask to overwrite if the destination file already exists
|
||||||
-L : If -R, follow sym links
|
cp -i ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
-n : Do not overwrite
|
|
||||||
-P : If -R, Do not follow sym links (Default)
|
|
||||||
-p : Preserve meta data
|
|
||||||
-R : Recursive (cp directories)
|
|
||||||
-X : Do not copy extended attributes or resource forks
|
|
||||||
-v : Verbose
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Export makes a variable something that will be included in child process environments
|
|
||||||
export VARNAME="value"
|
|
||||||
|
|
||||||
# Calling export with no arguments will show current shell attributes
|
# Calling export with no arguments will show current shell attributes
|
||||||
export
|
export
|
||||||
|
|
||||||
|
# Create new environment variable
|
||||||
|
export VARNAME="value"
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# kill - Kills a process
|
# Kill a process gracefully
|
||||||
|
kill -15 <process id>
|
||||||
|
|
||||||
# Kill gracefully
|
# Kill a process forcefully
|
||||||
kill -15 [PID]
|
kill -9 <process id>
|
||||||
|
|
||||||
# Force kill (*Only use if -15 does not work first, this is dirty*)
|
|
||||||
kill -9 [PID]
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# mv - move. Moves a file or directory
|
# Move a file from one place to another
|
||||||
mv [-f, -i, -n] [-v] [source] [target]
|
mv ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
|
|
||||||
-f : No prompt before overwriting something in target destination. Overrides any previous -i or -n args.
|
# Move a file from one place to another and automatically overwrite if the destination file exists
|
||||||
-i : Prompt before overwriting something. Overrides any previous -f or -n args.
|
# (This will override any previous -i or -n args)
|
||||||
-n : Do not overwrite anything. Overrides any previous -f or -i args.
|
mv -f ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
-v : Verbose
|
|
||||||
|
# Move a file from one place to another but ask before overwriting an existing file
|
||||||
|
# (This will override any previous -f or -n args)
|
||||||
|
mv -i ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
|
|
||||||
|
# Move a file from one place to another but never overwrite anything
|
||||||
|
# (This will override any previous -f or -i args)
|
||||||
|
mv -n ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
# Print Working Directory
|
# Show the absolute path of your current working directory on the filesystem
|
||||||
# The `pwd' command will show you the absolute path of your current directory on the filesystem
|
|
||||||
pwd
|
pwd
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
# wc - word count (or lines, characters, or bytes)
|
# Count the number of words (file or STDIN)
|
||||||
wc [-clmw] [output]
|
wc -w /path/to/foo.txt
|
||||||
|
cat /path/to/foo.txt | wc -w
|
||||||
|
|
||||||
-c : Number of bytes (cancels -m opt)
|
# Count the number of lines (file or STDIN)
|
||||||
-l : Number of lines
|
wc -l /path/to/foo.txt
|
||||||
-m : Number of characters (cancels -c opt)
|
cat /path/to/foo.txt | wc -l
|
||||||
-w : Number of words
|
|
||||||
|
# Count the number of bytes (file or STDIN)
|
||||||
|
wc -c /path/to/foo.txt
|
||||||
|
cat /path/to/foo.txt | wc -c
|
||||||
|
|
||||||
|
# Count files and directories at a given location
|
||||||
|
ls -l | wc -l
|
||||||
|
|
||||||
|
# If you ever use `wc` in a shell script and need to compare the output with an int you can
|
||||||
|
# clean the output (wc returns extra characters around the integer) by using xargs:
|
||||||
|
ls -l | wc -l | xargs
|
||||||
|
Loading…
Reference in New Issue
Block a user