1 Part Kali Linux Questions-3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

C = command

How to clear terminal command history

Ans;

cat > ~/.zsh_history

press enter then press control +C (pressing enter button is very important)

Q.No.1:- How to check present working directory?

Q.No.2:- how to check all the files and directories of current directory?

Q.NO.2(a): how to check detail of files or directories of a directory?

Q.NO.2(b): how to check hidden files or directories?

q.no.2(c); how to display files or directories with human readable sizes like in
MB or KB?

q.no.2(d); how to check directories and subdirectories and files?

q.no.2(e); how to show directories and files in reverse direction?

q.no.2(f) how to switch user from super user profile.

Q.No.3: how to check the information or the switches of a command?

Q.no. 4: how to go back from present working directory?

q.no.5; how to make a directory?

q.no5(a); how to make directory with name having space like muzammal
hussain gureja?

q.no.5(a1); how to exit from quote>

q.no.5(b) how to go inside the directory having space in name?

q.no.5(c): how to go in the system files directly from any path?

q.no.5(d); how to check hierarchy of a directory?


q.no.5(e); how to go in the last working directory?

q.no.6; how to check list of any directory from any place?

q.no.7; how to make blank file?

q.no.7(a); how to make multiple files up to 90 start with a?

q.no.7(b); how to make multiple files up to 90 with a difference of 5?

q.no.7(c); how to blank a text file having some data inside?

q.no.8; how to write something in a blank file?

q.no.8(a); make two files file1 and file2 in /tmp/ and write some data then
save their data in a third file file3 then make file4 with some data and again
save its data in file3.

q.no.9. how to remove directory or file?

q.no.10; how to remove file or directory from any place.?

q.no.11: how to go in any directory from any location?

q.no.12. how to read content of any text file?

q.no.13. how to copy file from one place to another place?

q.no.13(a). how to copy multiple files and to read the output?

q.no.13(b). copy files using wild card.

q.no.13(c); how to read file with line number including blank lines?

q.no.13(d); how to read file with numbering but ignoring blank lines?

q.no.13(e); how to read file from bottom to top?

q.no.13(f); how to read multiple files at a time?

q.no.13(g) how to count lines, words and characters of a file?


q.no.14; how to copy full directory including files and sub directories in
current location?

q.no.15; how to delete operating system. (Never use this command)?

q.no.15(a). delete files using wild card.

q.no.15(b); how to delete directory content without deleting the parent


directory?

First lecture comeplete

q.no.16; how to move files or directories?

q.no.16(a). move files using wild card.

q.no.17; how to rename file or directory?

q.no.18; how to make sub directories?

q.no.19; how to check sub directories content?

q.no.20; how to create soft and hard link of a file?

q.no.21; how to read file with screen by screen or line by line?

q.no.22; how to check how many users are in your system?

Q.no.23;what is tty?

q.no.24; how to shutdown and restart pc immediately?

q.no.24; how to run multiple commands one time?

q.no.25; how can we search a word in a file ignoring case sensitivity?


q.no.25(a); how to search other records except one or few more records ? like
search all records except “sbin” “nologin” “usr” or invert match

q.no.25(b); how to check that how many times a specific keyword is used in a
file?

q.no.25(c); how to search exact word match in a file?

q.no.25(d); how to find the line number of a particular record?

q.no.25(e); how to find a specific string in number of files with file path and
without file path in output?

q.no.25(f); how to find the file name who have a specific keyword?

q.no.25(g) make a file with few keywords then search all of these keywords in
many files at once.

q.no.25(h) how to find a keyword starting with specific letter or word like
country start with P.

q.no.25(i) how to find those lines ends with specific word.

q.no.25(j) how to find a keyword from 100s of files which are contain in one
directory. Or. Provide a list of keywords which are contain in one keyword file
and search this list from 100s of files.

q.no.25(k): find only words in line but exclude the lines. Just print words.

q.no.25(l). find the keyword in a file or multiple files without printing the
result.

q.no.25(m); search file which start with “con” in /etc directory.

q.no.25(n); search a word in an unknow file name but the directory path you
know. Like search “root” word in a directory /etc/

q.no.25(n1); find the lines which are commented in /etc/sudoers file.

q.no.25(o); find the uncommented lines in /etc/sudoers file.


q.no.25(p); search word “workgroup” in /etc/samba/smb.conf and then print
two lines before it, then print two lines after this word, then print 3 lines
before and after this word.

q.no.26; what is the use of pipe | symbol?

q.no.26(a); run a command lscpu and lsblk then find print the result with line
number.

q.no.26(b); run a command lscpu and lsblk then find the number of lines of
the output.

q.no.26(c); print the first 5 lines come from lscpu command with line number.

q.no,26(d); print the first 5 lines come from lscpu command with line number
then save the output in a new file in /tem/new-file

q.no.26 (e); print lines of /etc/passwd file from 31 to 35 using head and tail
commands also print lines numbers also save the output in a file name
“newfile”.

q.no.27; how to redirect the output of a command in a text file?

q.no.28; how to append new text in a text file?

q.no.29; where to redirect errors of a command?

q.no.30; redirect error of this command (find / -perm -u=s -type f) in null.

q.no. 31; how to check the number of words character etc. of a text file?

q.no.32; how to compress and uncompressed one or multiple file and


directory using bzip2, gzip, zip, 7z and archive using tar?

q.no.33 (a); how to zip multiple files in one file using zip tool?

q.no.33(b); how to see the content of a .7z file without extracting it?

q.no.33(c); how can we tar , untar(archive) and compress file together


using .tbz and .tgz extensions ?
vim text editor
q.no.34. how many modes of vim have?

Q.NO. : how to read only first 10 lines of a file?

You might also like