1/77
Looks like no tags are added yet.
What command finds out what the current shell being run is?
echo $0 / echo $SHELL
What metacharacters are used when you append output to a file?
>>
What is the command to display username?
whoami / id / echo $USER
What does ls -a do?
It lists all files which includes hidden ones
What do you call a path that begins with a slash?
An absolute path
What do you call a path name that does not begin with a slash?
Relative Path
Where does cd with no arguments take you
Home directory
What is the structure of the UNIX file system?
Hierarchical tree structure with root at / and branches
When you log into UNIX what directory are you in by default?
HOME directory
Given a directory structure, can you know where CD will take you?
Remember cd.. takes you one back.
Remember cd. take you to current directory.
What does the man command do?
The man command gives you information about the command you have as an argument
What metacharacter do hidden files start with?
.
What does echo $0 do?
Gives you what your current shell is. bash
What does you have to put in front of a variable to access it?
$
What option do you have to give the ls (list command) to show the permissions associated with the file?
-l long iist format
Environment variable?
All caps / all children know it
Redirection vs Pipes?
> (overwrite), >>(append),
echo $PATH Does what?
colon seprated list of directories
echo $$?
Displays PID
What happens if you run a program not in directory?
It won't find it.
What is the command to change permissions?
chmod
What is the command for copying a file?
cp
Command to change information on the associated file?
Chmod
What are the various ways to go to home directory?
cd, cd~, cd $HOME, cd absolute path
What is the command to create a file?
Touch
What is the command that displays the file type?
file
What is the command that display a text file one screen at a time?
more
Know what command helps you find a file or directory with a certain name
find [path] -name "filename"
Know the command that displays all files in tree structure?
tree
Know how to do a link command?
ln
Syntax: ln -s [original_file] [new_link] (symbolic)
What does the cat command do?
Outputs and displays the file
What does a grep command do?
Searches for patterns in a file
What command creates a new subdirectory?
mkdir
What command moves a file in a subdirectory and renames
mv
What does who command do?
Command that shows list logged in users
What happens if you use remove on a nonempty directory.
It will fail
How to remove a non-empty directory with flag
rm -r
What command gives absolute path for working directory
pwd
What does the touch command do?
It creates an empty file if file does not exist.
Inside a bash shell script what does: $$, $*, and $# do
−PID</p><p>* - list of parameters
$$# - number of parameters
$0 - gets name of script (shell)
Inside a script, what does $0 do
$0 - gets name of script (shell)
Identify assigning userdefined shell variable to string?
var="string"
What does environment variable $HOME hold
Home directory path
What is the naming convention of environment variables
CAPITALIZED
In a bash shell, what is the command to read an argument from the command line to the shell?
read
What does find -name do?
Helps you find a file or directory with the name parameter
How does the ls command list only hidden files in the current directory?
ls -d .*
What is the metacharacter to match 0 or more characters?
*
What does a question mark do as a metacharacter
That one character can be anything.
What metalevel character that makes a pipe between commands?
|
What mode does VIM open in?
Native mode (command mode)
Can you VIM a files that doesn't exist?
Yes
How to goes to insert mode in VIM?
Press i
How to leave insert mode?
Esc key
What do you have to use to enter command in vim
Press :
When in native mode, what is the command that deletes the line the cursor is located on?
Press dd
What mode does VIM start in?
Native mode
How to read ls -l?
permissions, user, group
How to read permissions
-(3-Owner/user rwx)(3Group)(3 Others)
Chmod options?
UGO
Can the root user do modify permissions on any file?
Yes, they can modify anything
If you execute a touch on a file that already exists, does it affect permissions?
No
What is a token
In a general computing or programming context, a token is the smallest individual unit of a program or command that has a specific meaning to the system.
The smallest piece like a command, arguments, etc.
ls
-o
What is the metacharacter that options start with?
-
Is echo a builtin command?
Yes
What is the first line of a script?
#!/bin/bash shebang
How to set an alias
alias name="command"
How to user grep on a file to look for a character
grep "character" filename
What does the .bashrc file do?
Saves aliases, functions, etc.
What can symbolic links link to?
Symbolic links only link to files and directories
Are all variables in a script file global by default?
No
How to declare a function
function() {}
Are functions still defined when you log out?
No, they are temporary
How do you use an export command
export var
How to activate and run a script metacharacters?
./
What is the basic if statement syntax
if [[ condition ]]
then
# Commands to execute if the condition is true
fi
What are some test operators
Integer Comparisons: -eq (equal), -ne (not equal), -gt (greater than), -lt (less than).
File Tests: -f (checks if a file exists), -d (checks if a directory exists).
String Tests: -z (checks if a string is empty), == (string equality), -n not empty
When does .bashrc file get activated
At startup of bash