Linux OS Flashcards
How much does a Linux OS cost?
Free, Linux is an open source - community supported OS based on the outdated UNIX OS.
What Linux terminal command would you use to get help/more information on a command?
man commandName
Opens an online manual into the terminal detailing the command and its’ uses.
man - short for online manual
How would you display the working directory contents in Terminal on Linux?
ls = list directory
Works like dir in Windows CMD line.
ls -l = displays the list with a lot more information (like file size, last modified time, access (read/write mode)). -l stands for long version
What command lets you rename a file in Terminal (Linux)?
mv
Short for move - by “moving it” you are renaming it
E.g. mv fileName/source newFileName/Destination
How to copy a file in Linux terminal?
cp
CoPy
cp fileName destinationFileName
Delete a file in Terminal? How to delete a directory with files in it?
rm fileName
Removes/deletes a file.
rm -R directoryName
Removes a non-empty directory.
What permissions would chmod 520 fileName.txt assign?
5 = read and execute permissions to Current user
2 = write only permission for Group users
0 = No permissions for Other uses
What does chmod command do?
E.g. chmod 710 fileName
Change Mode (chmod) Linux command changes the permissions of user types for the file.
E.g. Users can read write and execute the file (7)
Group users can only execute the file (1)
Other users with lower permissions than users or group can’t access the file at all (0)
When viewing a directory with ls -l a the top line starts: drwx—— what does this mean. What permissions does each use group (3 characters represents each of the 3 user type groups after the initial character which designates type of file)
d = directory, so the top of the active/working directory is a subdirectory
rwx = top level users can read, write and execute the directory/full permissions - 7
— = group level users can’t access it at all/no permissions - 0
— = other/bottom level users can’t access it at all/no permissions -0
What would you type to grant group level users permissions permission to read only the following file and no permissions to low level/other users:
drwxrwxrwx thisFile.txt
sudo chmod 740 thisFile.txt
7 = all permissions for root-users/top level
4 = read-only permission for group users
0 = no permissions for bottom level users
What does sudo do?
Allows you to run commands with elevated permissions/as an admin.
sudo - short for Super User DO
Basically elevates your permissions to root user level for a SINGLE command (can do ALL/Super User)
How to change file owner and group?
sudo chown
sudo elevates access to admin which is required to change file owner/group
chown stands for chANGE ownER
e.g. sudo chown ownerName:groupName file.txt
Why doesn’t chown ownerName fileName.txt work to change the mode/owner of a file?
Because chown requires sudo before it to run the single command as a root-level user/admin.
sudo prompts you for a superuser password
How to run Linux terminal as admin/super user sessions?
su
Short for Super User - prompts you for the admin password and then runs all subsequent Terminal commands as Admin/Super-User/elevated permissions
To leave su mode: exit
What’s the advanced packaging tool abbreviated to in Linux terminal? And what does it do?
apt
Manages the installing and uninstalling of applications on a Linux system.
Requires sudo privileges.
How to get out of su mode on Linux terminal?
exit
Type exit to leave su mode and go back to being a regular user/non-admin
How would you install Opera browser from a Linux Terminal?
How would you uninstall Opera browser from a Linux Terminal?
sudo apt-get install opera
apt-get handles the installing/uninstalling of software/applications on Linux - it requires sudo level privileges.
sudo apt-get remove opera
What does df command show? What does df -h command show?
disk free space (df) shows how many 1kb blocks of drive space you have available/free on your Linux system
Can add -h (human-readable) to display free space in mb/gb/tb
Command used to find a text string in a dir on Linux Terminal?
grep string directoryAddress
How to view Linux task manager (list of running tasks) equivalent?
ps
Processes - a list of all active processes on the Linux system and PID (Process ID)
ps -e
-e for everything/everyone’s (all users) use | more to limit it to page by page view
What does adding | more after a Linux command do?
Displays the given command results one page at a time (instead of jumping through all results to the last one) so it’s more easily readable/manageable.
How would you see just the apps/processes using the most resources on a Linux system?
top
Shows only the top resource using apps/processes currently running in real-time/live updated. As well as a load/utilisation over time.
Linux way of looking up a domain name and finding CNAME’s, linked IP addresses, etc?
dig
The dig command works like a more detailed (nslookup on Windows CLI)
How to find a file?
find
Command searches for a file name.
find . the . specifies to search in current directory