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