Environment Variables, Aliases Flashcards
When performing a long listing what do the objects show?
permissions links owner group size datemodified file/directory
i.e drwxr-xr-x. 2 cloud_user cloud_user 6 Oct 15 16:20 Desktop
How do you list files/directories?
ls
How do you list files/directories in order of size?
ls -S
i.e ls -lS
How do you do a detailed listing of files/directories?
ls -l
How do you do a reverse listing?
ls -r
How do you list a directory including its contents?
ls -R
How do you list in order of modification time?
ls -t
How do you get a listing of environment variables?
env
How do you view the directory locations bash will look in when entering a command?
echo “$PATH”
contained in the PATH environment variable
How do you reference something in the current directory?
.
i. e ./script1
* dot source
What is the command to list the current user?
whoami
What is the command to switch user?
su
i.e su user2
What is the command to switch the the root user?
su - *resets env variables
su *just switches user
What is the command to run as root interactively without the root password?
sudo -i
*useful if no root password exists (common)
What is the command to print the name of the OS?
uname
-r release -v kernel build -m/-p architecture -o os name -a all
What is the command to print the current working directory?
pwd
echo “$PWD”
What is the command to change to the home directory?
cd
cd ~
What is the command to change a directory up once
cd ..
What is the command to return to the previous directory?
cd -
*used OLDPWD env variable
echo $OLDPWD
What is the command to print a history of commands typed?
history
*located in ~/.bash_history
What is the command to print the contents of a file to the screen?
cat
How do you see the maximum commands the history file will store?
echo $HISTFILESIZE
How do you see the configuration of the history command?
echo $HISTCONTROL
i.e ignoredups *ignores consecutively repeated commands
How do you execute a specific command in denoted in history?
!
i.e !14