Command Line Basics Flashcards
How to get help in Linux
-?, -h or -help
grep –help
General syntax for a command Linux ?
command -[switch] parameter
Linux Control Function Keys
Ctrl+c : interrupts a process
Ctrl+z: Pauses a process
fg: Resumes a pauses process
How to graphically display folder and file structures
Use the tree command
command helps us find file in the linux file system.
It is very efficient and fast as it uses indexing databases.
locate
How to update the indexed database manually?
sudo updatedb
What are the Linux file permissions?
■ R for read
■ W for write
■ X for executable
What is chmod used for?
To change file permission
Syntax: chmod [permissions] [file]
use either the alphabets or bits to assign permissions
What command is used to change the ownership of a file?
chown
Syntax : chown root [file] . Use chown root:group [file]
What does the find command do ?
used to find files and doesn’t use indexed database.
take longer but gives but gives real-time outputs of the file locations. It is more robust and reliable.
ex: find path –name ″filename″
grep
It uses pattern based searching.
grep [search] [directory]
grep -a : searches binary files
What’s the linux boot process?
BIOS -> Boot loader (GRUB) -> initrd -> /boot
What is stored in /boot?
Kernel, initial ram disk, other files needed to boot the OS
What is is vmlinux or vmlinuz(compressed) ?
The linux kernel
How to view the kernel boot messages?
dmesg OR /var/log/dmesg
What are the linux runlevels?
0: power off
1: single user mode
2-5: normal system operations
6: reboot
Runlevels are replaced by systemd.
use systemctl command to change targets.
What does linux use for logging?
syslog
How does syslog categorizes messages?
By the use of:
- Facilities (the source of the message)
- Severities (Urgency categorization)
What are the Severity types in syslog?
- emergency
- alert
- critical
- error
- warning
- notice
- info
How does a syslog server process messages?
- syslogd
or rsyslog
or syslog-ng
How to generate your own log messages?
Use the logger utility.
How to automatically prune logfiles and keep your disk from filling with old messages?
Use the logrotate utility
What are the two types of disk partitions?
MBR - Master Boot Record (Max 2TB)
GPT - GUID Partition Table