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
Q

What tool is used to create file systems?

A

mkfs

ex: mkfs -t ext4 /dev/sdb2

26
Q

What is the df command for ?

A

To show how much disk is in use?

27
Q

What is the umount command for?

A

To disconnect a disk from the linux system.

ex: umount /dev/sdb2

28
Q

What is /etc/fstab used for?

A

To control what file system gets mounted where and in what order.

29
Q

How to view the labels and UUIDs of storage devices attached to the system?

A

Use:
lsblk -f
blkid

30
Q

How to create disk lables?

A

e2lable

31
Q

Where are account information stored?

A

/etc/passwd and /etc/shadow

32
Q

What attributes accounts have?

A
username
UID
GID
Comment
home directory 
shell
33
Q

How to Create, Delete, Modify accounts?

A

useradd
userdel
usermod

34
Q

Where is the group information stored?

A

/etc/group

35
Q

How to create, delete, modify a group?

A

groupadd
groupdel
groupmod

36
Q

How to view group memberships for accounts?

A

groups {account}
groups
ex: groups bob

37
Q

Class A first octet?

A

1 .0 > 127.0

38
Q

Class B

A

128.0 > 191.255

Hosts: 65, 536

39
Q

Class C

A

192.0.0 > 233..255.255

Hosts: 255

40
Q

What is the Private Address Space?

A
  1. 0.0.0 - 10.255.255.255
  2. 16.0.0 - 172.31.255.255
  3. 168.0.0 - 192.168.255.255
41
Q

How to display the FQDN?

A

hostname -f

42
Q

How to display the hostname?

A

hostname
or
uname -n

43
Q

To lookup or resolve an IP or a DNS name?

A

Use :
host
or
dig

44
Q

What does the /etc/hosts file contain?

A

A list of IP addresses and host names

45
Q

what does /etc/nsswitch.conf file do?

A

Controls the order in which lookups are performed.

ex: DNS or hosts file first.

46
Q

How to define if network interfaces use DHCP or Static?

A

Red Hat: /etc/sysconfig/network-scripts/ifcfg-Device

Ubuntu: /etc/network/interfaces

47
Q

Shell environment configuration is located?

A

/etc/profile

48
Q

How to manually assign IP addresses?

A

Use ip or ifconfig

ifup/ifdown : to bring up or down an interface

49
Q

How to see the process running on a system?

A

ps

50
Q

How to display a list of jobs?

A

jobs

51
Q

How to kill a process or job?

A

kill PID/job ID

52
Q

Schedule a task?

A

cron

53
Q

How to
■ Make changes to stream of texts?
■ Search and replace text?

A

sed

Ex: s/old/new/g interpret as string///replace all strings found.

54
Q

What is sort used for ?

A

To organize that we get for an output

55
Q

What is uniq used for?

A

To remove redundant results

Usually used with
The -c switch is used to count the words

56
Q

What is used for?

ListOpenFiles

A

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
Q

How to create hidden files in linux?

A

start the file name with a ( . )

58
Q

How to create a batch of new users?

A

Use the command

A batch mode for creating new users.