VMWARE Linux Command Prompt Flashcards
What does $cd / do?
Take you to the root directory
What does $cd ~
Take you to the home directory
what does $pwd do?
pwd shows you the current directory your in / route or pathway
What does $ls do?
lists all the directorys and files in the current directory.
$cd ..
goes back a directory/goes out a directory
What is absolute addressing?
Absolute addressing takes you straight to the place you want to go
starting from the root.
e.g.
$cd /lib/books
What is relative adressing?
Relative addressing takes you to the place you want to go in steps. starting from the current directory for example.
e.g.
$cd ../../lib/books
As you can see this doesn’t start with a / as well because its relative
What does $mv file1.txt milo
it moves file1.txt into the milo directory
What does $mkdir milo
Makes a directory called milo
What does $rm -r milo
deletes the directory called milo
(You have to add a -r if you’re trying to delete a directory)
What does $rm file1.txt
deletes the file1.txt
What does $man mv
Shows a manual page of mv/instructions of what it does
What does $touch file1.txt do?
It creates the file called file1.txt
What does $echo funny guy > file1.txt do?
puts funny guy into file1.txt
What does $cat file1.txt do?
It shows the contents of the file1.txt
$Ps a
Shows all running directory’s or files.
What does $bash rage.sh do?
bash is the first word before running a script.
for example.
bash rage.sh
If there is any code in the file it will run for example:
cat file1.txt – (This will print the contents of file1.txt when $bash rage.sh is run)
What does $mv file1.txt file2.txt do?
this changes the name of file1.txt into file2.txt
$ps a
Shows users running directories and files
How do I open a gedit file? and what is it used for?
You open a gedit file by doing
gedit rage.sh
This creates a file/script called rage.sh
This could be used to run scripts. The use of it depends on the scripts implemented into the file.
What does $cp file1.txt do?
copies the file1.txt and replaces the file1.txt if there is a file called file1.txt
What usual format of an user input script?
echo “Do you like tacos?”
read [input variable] -in this case well do choice
read choice - this would be in line 2, choice is the input variable.
Wow, $choice is an interesting choice.
What does $cp -i file1.txt do?
copies the file1.txt and replaces the file1.txt but asks if the user wants to replace the file if there is a file called file1.txt
What is the format of a while loop that contains string in a script?
i=”Rah”
while [ $i == “Rah” ]
do
echo “I will find you”
i= “Found you”
done
What is the format of a while loop that contains integers?
i= 0
while [ i !lt 9 ]
then
((i++))
done
What is the format of an if statement that contains string in a script?
What is the format of an if statement that contains integers in a script?
What is a benchmark?
What are wildcards and what do each characters do?
Wildcards are characters that fill in gaps for the user, if inputted.
This is to save time for the user if there’s a specific code or to shorten down the list.
e.g.
* - is for multiple characters
? - single character
What would $find P*d search for?
anything starting with p and ending with d how many characters are in between p and d. (Inbetween the f and shire btw)
What would $find f??dshire search for
would search for words containing f and ending with shire along with 2 characters in between them. (Inbetween the f and shire btw)
What does $ls -l do?
lists the files and directories in a long listing format. (current directory)
What does $ls -r do?
lists the files and directories in reversing order (current directory)
What does $ls -lt do?
lists the files in order of modification. (current directory)
What does $ls -lS do?
lists the files in order of size. (current directory)
What does $ls -d do?
Lists the directories themselves, not their contents.
What does $exit do?
Exits the shell.
What does $clear do?
“clears” the command prompt/shell
but it takes you further down
I’d say clears the shell/command prompt.
what does $date do?
shows the systems date
what does ls -d/etc
lists all the files in the etc folder.
what does tail -n funny.txt do?
it displays the last 10 lines of funny.txt
what does head -n funny.txt do?
displays the first 10 lines of funny.txt
what does stat do?
shows the statistics of the files and directories.