Command Line Operations (CLOs) - Basic Operations Flashcards
With what command can you after pressing Alt + F2 open the terminal?
gnome-terminal
What are four main commands, often used?
man: view documentation
head: show first lines of file
tail: show last lines of file
cat: type out a file
What are the three basic elements of most input lines at shell prompts? What do they do?
- command (name of program or script ot be executed)
- options (modify what the command does)
- arguments (what command operates on)
How are options distinguished from arguments?
By starting with one or two dashes
i.e.
-p or –print
What are Virtual Terminals? (VT)
- console sessions that use the entire display and keyboard outside of a graphical environment
- considered virtual, because only one terminal remains visible at a time
For what are Virtual Terminals useful?
- i.e. when you run into problems with the graphical desktop
How can a Virtual Terminal be accessed?
Ctrl + Alt + Function Key
(1-7)
7 -> graphical desktop
How can the graphical desktop be started/stopped?
Depends on the distro
Newer system-based distros use systemctl
like
sudo systemctl stop gdm or sudo telinit 3
restart it
sudo systemctl start gdm or sudo telinit 5
How can you log in and log out using the ssh command?
ssh student@remote-server.com
- would connect securely to remote machine (remote-server.com)
- and give student a command line terminal window
- using either a password or a cryptographic key to sign in without providing a password to verify the identity
What happens when you run the shutdown command?
- sends a warning message
- prevents further users from logging in
- init process takes control shutting down or rebooting the system
- its important to always shutdown properly; failure to do so can result in damage to the system and/or loss of data
Which commands can be used to shutdown a machine?
- shutdown
- halt (runs shutdown -h)
- poweroff (runs shutdown -h)
- reboot (runs shutdown -r)
How can you locate the folder of a command?
using which utility
Like
which diff
output: /usr/bin/diff
Alternatively, if which does not find it:
whereis diff
-> looks for packages in a broader range of system directories
Also locates source and man files packaged with the program
How can you see what you home directory is?
echo $HOME
What are four useful commands for directory navigation?
- pwd: displays present working directory
- cd ~ or cd : change to your home directory; shortcut name is ~ (tilde)
- cd .. : change to parent directory
- cd - : change to previous working directory
What does the command do:
pushd /folder
Changes the folder to target and adds it to history list, from where you came
What does the command do:
popd /folder
Puts you back in the history, created with pushd
Walking in reverse order, most recent directory will be the first one retrieved with popd)
How does an absolute Path start?
always with /
How are multiple / dealth with as a pathname?
valid but seen as only one /
How can you get a birds-eye view of a filesystem?
command:
tree -d
to see just directories and to suppress listing file names
What shortcut can clear a terminal?
Crtl + L
How can you view the sizes of filesystems?
df -h
What does the command do:
ls -li
- i option prints out in the first column the inode number, a unique quantity for each file object
How can you create a hard link to a file?
ln file1 file2
What is a hard link?
- also called symbolic links
- points to the exact same data as the original link
What is important to think about when working with hard links?
- can easily lead to subtle errors
- editing files linked to with a hard link might have consequences, depending on the editior: most retain the link by default, but not all
How can you create soft links?
ln -s file1 file3
What is a soft link?
- take no extra space in file system (unless names are very long)
- extremely convenient
- can be easily modified to point to different places
How do soft links differ from hard ones?
- soft links can point to objects even on different filesystems, partitions and or disks and other media
- which may currently not be available or exist
- if so, you obtain a dangling link
how can you see the list of directories created with pushd?
dirs