Intro to Linux Flashcards
What argument for the -type option of the find command is used to search for directories?
d (as in “find -type d”)
What command will display all files in all directories and subdirectories from the user’s home directory?
find ~
Which of the following arguments for the -type option of the find command is used to search for symbolic links?
l (as in “find -type l”)
What is the “wc” command?
Meaning “word count”, the “wc” command is used to count the number of lines, words, and bytes (or characters) in a file or input. By itself it shows the number of lines, words, and bytes (or characters) in the file(s), in that order. “wc filename.txt”
What is the “find” command?
The “find” command searches for files and directories in a specific location
Which one is NOT a valid -type option for the find command? [a, b, c, d]
‘a’ is not valid
Which of the followings are logical operators of the find command? [-not, -and, -xor, -true, -or]
-not, -and, -or
What is the difference between the “locate” and the “find” commands?
“locate” searches for the files using a pre-built database, while the “find” command searches the filesystem in real time for the desired file/directory.
What command will remove the files you scare up with the “find” command?
“-remove”
What argument for the -type option of the find command is used to search for files?
f (as in “-type f”
How do you use the output of one command as the input of a second?
”|”, also known as “pipe”.
What command can you use to update the locate database?
updatedb (“sudo updatedb”)
What command is used to update the timestamps of files?
“touch”. It can also make files
What option of the find command do you use to add another option?
“-and” (“find -option -and -option”)
What option of the find command do you use to negate something, or in other words, find its’ opposite?
“-not” (“find -not -option”)
What three numbers do you add up to set permissions in Linux, and what do they mean?
4 (read), 2 (write), 1(execute)
What three entities do you set permissions for?
The owner, the group, and “other”.
What four characters do you use to set permissions, and what do they mean?
r (read), w (write), x (execute), and -(null/nothing). Example: rwx, r-x, r–
What command allows you to find files by name by looking up a database?
“locate”
What command allows the user to search for files in a directory hierarchy with versatile options?
“find”
Which are the symbolic notations for the chmod command?
u, g, o, a
What number base do computers use?
Base 2.
What are the entities in the Linux (or Unix) security model?
user, group, and world(others)
What command can you use to display the user’s identity?
id
What commands let you login as the super user?
“su - root”, “su -“, “su -l root”
Tell me five valid file types in Linux as an output of ls -l command
”-“ (regular files), “d” (directories), “c” (character devices), “b” (block devices), and “l” (symbolic link)
What command can you use to change the group ownership of a file?
“chgrp”
How do you change a file’s owner?
“chown”
What does the ‘w’ permission attribute do?
Allows the file to be written and edited
What command changes a user’s password?
“passwd”
What command can you use to execute a command as another user?
“sudo”
Where is user account information stored?
/bin/user
How do you change a file’s mode?
“chmod”
How do you set default permissions on a file?
“umask”
What does the ‘r’ permission attribute do?
Allows the file to be opened and read
What does the “ping” command do?
Send an ICMP ECHO_REQUEST to network hosts
What does the “traceroute” command do?
Print the route packets to trace to a network host
What does “ip” do?
Show/manipulate routing, devices, policy routing and tunnels
What does “netstat” do?
Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
What does “ftp” do?
It is an internet file transfer program
What does “wget” do?
It is a non-interactive network downloader
What does “lcd” do within the “ftp” program?
It changes the directory on the local system
What does “bye” do within the “ftp” program?
log off the remote server and end the session
What is a container?
It’s a lightweight, isolated environment where you can run applications. Each container has everything that the application needs to run: code, tools, libraries, and settings.
How is a container different from a virtual machine?
A virtual machine has its own OS, while the container uses the host system’s OS; It borrows its kernel. This makes containers less isolated, but more light-weight and memory efficient.
What login name should you be given when accessing a public FTP server?
“anonymous”. If it wants a password, its usually your email address.
Which commands can you use to display routing information?
“ip route show” and “ip r”
Which command can you use to test the connectivity to the remote host?
“ping <hostname/ip>”
What does the scp command do?
Copies files across a network securely (Secure copy)
Using SSH how would you connect to a remote host named remote-sys?
“ssh remote sys”
What option allows you to encrypt an dssh connection?
The -c option in SSH specifies the encryption cipher to use for the connection
What is a unique feature of “sftp”?
Only the SSH server is needed on the server side
What is “sftp”?
SFTP (Secure File Transfer Protocol) is a way to transfer files between computers over the internet, using SSH to encrypt the data.
What is “ssh”?
SSH (Secure Shell) is a protocol used to securely connect to a remote computer over a network. It allows you to log into another computer, execute commands, and transfer files safely, even over unsecured networks.
Which information is displayed when ping operation succeeds?
Delay (or how long it took for the packets to get there), packet size, and the destination host’s name (could be ip or hostname)
What does “ssh” stand for?
Secure Shell
What does “get fileName” do within the ftp program?
In an FTP program, “get fileName” is a command used to download a file from the remote FTP server to the local system.
What commands can you use to display the assigned IP address information?
“ip address show” and “ip a”
How do you make a script?
Create a file - you can use a text editor like vim or nano to do this when you open the editor - specify an interpreter, write your commands and save, and give your file execute permissions
How do you exit insert mode in vim?
use ESC key
How do you save and quit in vim?
:wq
How do you run your script1.sh using the source method?
”. <scriptname>" or "source <scriptname>"</scriptname></scriptname>
Run your script1.sh in a child bash shell?
”./<path/to/scriptname>”
How do you run a script if the script isn’t executable, or you don’t want to make it executable?
“bash <scriptname>"</scriptname>
How do you run your script1.sh as an executable file?
“path/to/scriptname”
How do you define a variable?
“var_name=var”
What is a stub function?
Its like any other function in programming - a box you can put commands into, to tidy things up.
“functionName(){
}”