Lect99 - Example papers Flashcards
The /proc directory is a location for
Virtual file system for process and kernel information
The /etc directory is a location for
Configuration files
The passwd file can be found in
/etc
To transfer ownership of the file toto from dave to nicola type
chown nicola toto
The /etc/services file contains
a list of port mappings for the system (tcp and udp)
To set the read, execute permission of the file toto for group and other type
chmod 755 toto
In an Ubuntu system, the command sudo apt-get dist-upgrade is used to
Upgrade an existing installation and add new packages if needed.
To identify which shell an user is using, (s)he looks in
/etc/passwd (shows default shell)
The command ls -lh is used to show:
a long listing of a file or directory of files, including permissions mod time and size in human readable format.
The /bin directory is a
directory for common executables
The /sbin directory is a location for
for system executables usually used by root
To view the boot message from the kernel type:
dmesg
To show the IP address of the current host, type:
ifconfig
The command ls [t][ne]* is used to list:
files that start with the letter t followed by either an n or e
The /usr directory is a
user binaries, libraries and other software (the majority of the system is in here)
The command cat /etc/passwd | egrep /bin/bash is used to show:
entries in /etc/passwd that contain the string /bin/bash
To run a command vi as root, type:
sudo vi or su – vi
To extract the usernames of all users on your system from /etc/passwd type:
cat /etc/passwd | awk -F’:’ ‘{print $1}’ cat /etc/passwd | cut -d’:’ -f1
To count the lines in a file toto, type:
cat toto | wc -l
To print the result of the command who to a file users.txt, type:
who > users.txt
Change to home directory
cd /home cd ~
Move a file
mv file /destination/file
Delete lines 2 to 3 of a file called toto
sed -e ‘2,3d’ toto
Create a directory tata
mkdir tata
Extract characters 6 to 8 from each line of a file called data
cut -c 6-8 data
To display the content of a text file
cat file less file
To display all lines in a file called toto that contains a number
grep [:digit:] toto
Display all lines of the file data that contain a number from 0 to 9
grep [0-9] toto
Calculate the SHA1 hashes of all files in a directory without showing filenames
sha1sum * | cut -d’ ‘ -f1 sha1sum * | awk ‘{print $1}’
Display all lines except line 10 of file toto
sed -e ‘10d’ toto
Search for the string “hacker” in ps.dd
grep -a hacker ps.dd
Search for IP addresses in ps.dd and place the results in a file called IP.log
egrep -a –color=always ‘([0-9]{1,3}.){3}[0-9]{1,3}’ ps.dd > IP.log
Search for Friday May 26, 2017 and “gmail” in the IP.log file above
egrep ‘Friday May 26, 2017.*gmail’ IP.log
Extract lines that contain the userID=12345 from the file IP.log and place the results in a file called User.log
grep ‘userID=12345’ IP.log > User.log
Extract lines that contain the email address from the file User.log above
grep “email address” User.log
List the first ten characters of the SHA1 sum of sp.e01
sha1sum sp.E01 | cut -c 1-10
Convert sp.E01 to a raw image
ewfexport sp.E01
List the partitions in the image, reporting in units of sectors
mmls sp.E01