Command Line Basics Flashcards

1
Q

How to get help in Linux

A

-?, -h or -help

grep –help

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

General syntax for a command Linux ?

A

command -[switch] parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Linux Control Function Keys

A

Ctrl+c : interrupts a process
Ctrl+z: Pauses a process
fg: Resumes a pauses process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to graphically display folder and file structures

A

Use the tree command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

command helps us find file in the linux file system.

It is very efficient and fast as it uses indexing databases.

A

locate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to update the indexed database manually?

A

sudo updatedb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the Linux file permissions?

A

■ R for read
■ W for write
■ X for executable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is chmod used for?

A

To change file permission
Syntax: chmod [permissions] [file]
use either the alphabets or bits to assign permissions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command is used to change the ownership of a file?

A

chown

Syntax : chown root [file] . Use chown root:group [file]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the find command do ?

A

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″

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

grep

A

It uses pattern based searching.
grep [search] [directory]
grep -a : searches binary files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What’s the linux boot process?

A

BIOS -> Boot loader (GRUB) -> initrd -> /boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is stored in /boot?

A

Kernel, initial ram disk, other files needed to boot the OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is is vmlinux or vmlinuz(compressed) ?

A

The linux kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to view the kernel boot messages?

A

dmesg OR /var/log/dmesg

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the linux runlevels?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does linux use for logging?

A

syslog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How does syslog categorizes messages?

A

By the use of:

  • Facilities (the source of the message)
  • Severities (Urgency categorization)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the Severity types in syslog?

A
  • emergency
  • alert
  • critical
  • error
  • warning
  • notice
  • info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How does a syslog server process messages?

A
  • syslogd
    or rsyslog
    or syslog-ng
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How to generate your own log messages?

A

Use the logger utility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How to automatically prune logfiles and keep your disk from filling with old messages?

A

Use the logrotate utility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are the two types of disk partitions?

A

MBR - Master Boot Record (Max 2TB)

GPT - GUID Partition Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are the three disk partition utilities ?

A

fdisk: Create and modify partitions
gdisk
parted

25
What tool is used to create file systems?
mkfs | ex: mkfs -t ext4 /dev/sdb2
26
What is the df command for ?
To show how much disk is in use?
27
What is the umount command for?
To disconnect a disk from the linux system. | ex: umount /dev/sdb2
28
What is /etc/fstab used for?
To control what file system gets mounted where and in what order.
29
How to view the labels and UUIDs of storage devices attached to the system?
Use: lsblk -f blkid
30
How to create disk lables?
e2lable
31
Where are account information stored?
/etc/passwd and /etc/shadow
32
What attributes accounts have?
``` username UID GID Comment home directory shell ```
33
How to Create, Delete, Modify accounts?
useradd userdel usermod
34
Where is the group information stored?
/etc/group
35
How to create, delete, modify a group?
groupadd groupdel groupmod
36
How to view group memberships for accounts?
groups {account} groups ex: groups bob
37
Class A first octet?
1 .0 > 127.0
38
Class B
128.0 > 191.255 | Hosts: 65, 536
39
Class C
192.0.0 > 233..255.255 | Hosts: 255
40
What is the Private Address Space?
10. 0.0.0 - 10.255.255.255 172. 16.0.0 - 172.31.255.255 192. 168.0.0 - 192.168.255.255
41
How to display the FQDN?
hostname -f
42
How to display the hostname?
hostname or uname -n
43
To lookup or resolve an IP or a DNS name?
Use : host or dig
44
What does the /etc/hosts file contain?
A list of IP addresses and host names
45
what does /etc/nsswitch.conf file do?
Controls the order in which lookups are performed. | ex: DNS or hosts file first.
46
How to define if network interfaces use DHCP or Static?
Red Hat: /etc/sysconfig/network-scripts/ifcfg-Device Ubuntu: /etc/network/interfaces
47
Shell environment configuration is located?
/etc/profile
48
How to manually assign IP addresses?
Use ip or ifconfig | ifup/ifdown : to bring up or down an interface
49
How to see the process running on a system?
ps
50
How to display a list of jobs?
jobs
51
How to kill a process or job?
kill PID/job ID
52
Schedule a task?
cron
53
How to ■ Make changes to stream of texts? ■ Search and replace text?
sed Ex: s/old/new/g interpret as string///replace all strings found.
54
What is sort used for ?
To organize that we get for an output
55
What is uniq used for?
To remove redundant results Usually used with The -c switch is used to count the words
56
What is used for? | ListOpenFiles
Shows files that are currently being accessed Display a lot of system usage Can be used to find files that shouldn't be open
57
How to create hidden files in linux?
start the file name with a ( . )
58
How to create a batch of new users?
Use the command A batch mode for creating new users.