Lect03-04 - Bash + vi Flashcards

1
Q

What is a shell?

A

The shell is a program that takes commands from the keyboard and gives them to the operating system to perform

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

What is bash?

A

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell.

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

What is a terminal?

A

This is a program that opens a window and lets you interact with the shell.

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

File permissions:
What is the command to change permission for file.txt?

A

chmod <octal> file.txt</octal>

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

File permissions:
What does -

  • chmod u+rw somefile
  • chmod o-rwx somefile
  • chmod a+r somefile
  • chmod a=rx somefile
A
  • This would give the user read and write permission.
  • This will remove read/write/execute permissions from other users (doesn’t include users within your group).
  • This will give everyone read permission for the file.
  • This would give everyone execute and read permission to the file, if anyone had write permission it would be removed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

File permission:

What is -

  • 777
  • 755
  • 700
  • 666
  • 644
  • 600
A
  • rwx rwx rwx
  • rwx r-x r-x
  • rwx — —
  • rw- rw- rw-
  • rw- r– r–
  • rw- — —
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the following file types indicated by the first character of ls -l output:

  • -
  • d
  • b
  • c
  • l
A
  • Regular file
  • directory
  • Block devices (SCSI or IDE disk)
  • Character device (serial port)
  • Link (points to another file or directory)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are file attributes?

A

Linux file systems (like ext2, ext3, ext4) support what are called file attributes. Attributes are flags that can control what file operations are allowed to occur on a file or a directory. There are two that can be very useful for protecting forensic data from haphazard deletion or tampering. These are append only (a) and immutable (i).

  • # lsattr <filename></filename>
  • # chattr +i <filename></filename>

+/- A: No access time updates

+/- a: Append only

+/- s: Secure deletion

+/- i: Not possible to delete

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

What is a symbolic link?

A

Symbolic links are a special type of file that points to another file. With symbolic links, it is possible for a single file to have multiple names. Here’s how it works: Whenever the system is given a filename that is a symbolic link, it transparently maps it to the file it is pointing to. To create symbolic links, use the ln command.

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

Explain the following POSIX Character Classes:

  • [:alnum:]
  • [:alpha:]
  • [:digit:]
  • [:upper:]
  • [:lower:]
A
  • Alphanumeric characters
  • Alphabetic characters
  • Numerals
  • Uppercase alphabetic characters
  • Lowercase alphabetic characters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you change the default file permissions?

A

By default, when you create a file as a regular user, it’s given the permissions of rw-rw-r–. You can use the umask (stands for user mask) command to determine the default permissions for newly created files.

The umask is the value that is subtracted from the 666 (rw-rw-rw-) permissions when creating new files, or from 777 (rwxrwxrwx) when creating new directories. For example, if the default umask is 002, new files will be created with the 664 (rw-rw-r–) permissions, and new directories with the 775 (rwxrwxr-x) permissions.

To display the current value of umask, run the umask command without any options. To temporarily change your umask value, run the umask VALUE command. This changes the umask value only for the current shell. To change the default umask value permanently for a specific user, you need to modify the .bashrc file in the user’s home directory. For example, to change the default umask for user bob, just add the following line at the end of the /home/bob/.bashrc file.

To change the default umask value permanently for all users, you can use the following command:

pam-config -a –umask –umask-umask=VALUE

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