bash - bash38-end Flashcards
/dev/null
The permanently empty file
touch «filepath»
Create an empty file at «filepath», or update its modification time
date
Print the current date and time
file «filepath»
Print the type of file at «filepath»
command 2> «filepath»
Run «command», sending stderr to «filepath»
command &> «filepath»
Run «command», sending stdout and stderr to «filepath»
kill -9 «pid»
Kill the process with ID «pid»
make «target»
Build the target «target» using the Makefile in the current directory
history
Print the command history
«name»=«value»
Set the shell variable «name» to «value»
…
Shell quotation that expands variables and interprets some special characters
…’
Shell quotation that interprets everything literally
...
Shell quotation that runs the command inside and substitute its output
USER
The shell environment variable set to the name of the current user
HOME
The shell environment variable set to the home directory of the current user
PATH
The shell environment variable set to the directories to search for commands
SHELL
The shell environment variable set to the path of the current shell
PWD
The shell environment variable set to the current working directory
source «filepath»
Execute the commands in «filepath» in the current shell (as if they were typed)
$?
The exit status of the last command
cmd1 ; cmd2
Run cmd1, then run cmd2
cmd1 && cmd2
Run cmd1, then run cmd2 only if cmd1 succeeded
cmd1 || cmd2
Run cmd1, then run cmd2 only if cmd1 failed
[[ «condition» ]]
Test if «condition» is true
$(…)
Run the command inside and return its output
$((…))
Evaluate the arithmetic expression inside
$«name»
Substitute the value of the shell variable «name»
(cmd)
Run cmd in a subshell
“current working directory”
The directory the shell uses as a reference point for relative paths.
home directory
What you call the directory where that user’s files typically reside.
pwd
The command that prints the shell’s current working directory
ls
The command that prints the contents (files and directories) in the current working directory.
ls «dirpath»
The command that prints the contents of the named directory, «dirpath».
ls –a
The command to print directory contents including hidden files
ls –l
The command to print directory contents in a long, more descriptive format
.
The hidden directory that refers to the directory itself
..
The hidden directory that refers to a directory’s parent directory