Command Line Flashcards
terminal
an application which allows access to underlying shells
Why Terminals?
1) More fine-grained, predictable, and direct control
2) Automation and programmability
3)
1) More fine-grained, predictable, and direct control
2) Automation and programmability
3) Common interface across operating systems
Why Terminals?
1) More fine-grained, predictable, and direct control
2)
3) Common interface across operating systems
1) More fine-grained, predictable, and direct control
2) Automation and programmability
3) Common interface across operating systems
Why Terminals?
1)
2) Automation and programmability
3) Common interface across operating systems
1) More fine-grained, predictable, and direct control
2) Automation and programmability
3) Common interface across operating systems
Why Terminals?
1) M
2) A
3) C
1) More fine-grained, predictable, and direct control
2) Automation and programmability
3) Common interface across operating systems
command line
a spot where commands are entered by the user for a given shell
pwd
print working directory - where the command line is
which ________
Find out where ________ (a command) is located on system
echo ________
prints whatever _________ is in the terminal or adds __________ to a file
What does this command do?
echo “A change to file_1.txt”»file_1.txt
This command added the line A change to file_1.txt to the file_1.txt file.
What does this command do?
echo “Brown Fox Runs”
prints out “Brown Fox Runs” in the terminal
What is the $PATH?
A environment variable that allows the system to search for a command in all directories defined by the variable
typical $PATH directories:
/usr/bin
/bin
/usr/sbin
/sbin
ls ________
display the contents of ____________ a directory or folder
ls .
lists the contents of the current folder
ls ..
lists the contents of one folder up
cd __________
change directory to ___________
cd ..
move one folder up
mv
move or rename folders or files - (Destructive)
mv old_name new_name
renames the file old_name to new_name
mv ../file_to_move ./
moves file_to_move from one directory up into your current directory
mv file_name/ ../
moves file_name one directory up
mkdir __________
makes a new folder or multiple new folders
rmdir __________
removes a empty folder or multiple empty folders (Destructive)
touch __________
creates an empty file. Can also update a timestamp of the file
cp
copies a file to a new location. can also copy entire directories.
cp ../file_to_copy ./
copies file_to_copy from one directory up into your current directory
rm
removes a file, directory, multiple file, or multiple directories (Destructive)
rm remove_me
removes the file remove_me
rm remove_me1 remove_me2
removes the files remove_me1 and remove_me2
rm -r __________
removes a directory and all of it contents (very destructive)
man __________
manual page for ___________(command) Press q to exit
man cp
manual page for cp
whatis _________
basic description of ____________
What does the -l in ls -l do?
-l: This flag tells ls to show the output in long format, which includes additional information about each file or directory, such as its permissions, owner, size, and modification time.
What does the -a in ls -a do?
-a: This flag tells ls to show all files, including hidden files (which are typically files whose names start with a dot).
What does the -la in ls -la do?
It tells the system to apply both the -a and -l flags
what does the . after a git command do?
A period (.) after a command is used as shorthand to refer to the current working directory. This is commonly used in commands that require a path argument, such as the git add command.
For example, if you run the command git add ., Git will stage all the changes in the current directory and its subdirectories for the next commit.
What does echo $0 print?
The command “echo $0” is used to print the name of the current shell that is running. The “$0” represents the name of the currently running script or shell.
What does echo $SHELL print?
The command “echo $SHELL” is used to print the absolute path of the current shell that is running. The “$SHELL” variable contains the path of the current shell interpreter that is being used by the user.
What does echo $PATH print?
The command “echo $PATH” is used to print the list of directories that are currently in the search path for executable programs. The “$PATH” variable contains a colon-separated list of directories where the shell looks for commands when a user enters a command name.