Topmost Using Kali Linux Commands
June 03, 2023
Basic Using Commands
ls - list file
mkdir - create directory.
cd - Change directory, move inside directory.
cd .. - move to parent directory
cd / - move to root directory.
rmdir - remove empty directory.
cat
Display content of file – cat filename
Create file – cat > filename (ctrl+d to exit)
pwd - present working directory
command:
ls - this command shows the list of files and directory
cp - the cp(copy) command is used to copy file
mv - the mv(move) command is used to move file and rename file
wc – The wc (word count) command counts lines, words, and characters
sort - this command display the content of file in sorted order
cat - The cat command is used to create file and display content of a file.
cut - you can slice a file vertically with the cut command.
grep - Use grep to search a file for a pattern and display both matching and nonmatching lines.
head - The head command displays the top of the file. By default, it displays the first 10 lines:
tail - The tail command displays the bottom of the file. By default, it displays the last 10 lines:
uniq - uniq simply fetches one copy of each line and writes it to the standard output.
diff - The diff command is used to display differences in files.
echo – Display Message.
printf – Display message
touch – used to create empty file
which - The which command tells you the directory that contains the
whereis - Unlike which, which confines its search to the directories
in PATH, whereis looks up a larger list.
whatis - whatis command is used to get a one-line manual page descriptions.
who - who is used to View the List of Current Users
whoami - It displays the username of the current user.
w - w command is used to show who is logged on and what they are doing.
tty- In Linux, everything is a file. Even any hardware device connected to the system is represented as a special file. Terminal is also represented as a file. Print the file name of the terminal connected to standard input.
uname – Display the name of the operating system.
ps- ps (process state) command is used to list the currently running processes.
pwd- Display present working directory.
history- list the previously used command
ls -l
1. Type and Permissions The first column of the first field shows the file type. Here we see three possible values—a - (ordinary file), d (directory), or l (symbolic link). Most files here are ordinary files. The remaining nine characters form a string of permissions which can take the values r, w, x, and -.
2. Links The second field indicates the number of links associated with the file. UNIX lets a file have multiple names, and each name is interpreted as a link. Directories have a link count of at least two.
3. Ownership Every file has an owner. The third field shows the owner of file.
4. Group Ownership - The fourth field shows the group owner of the files.
5. Size The fifth field shows the file size in bytes. This actually reflects the character count and not the disk space consumption of the file.
6. Last Modification Time The sixth field displays the last modification time in three columns— a time stamp that is stored to the nearest second.
7. Filename The last field displays the filename, which can be up to 255 characters long. If you would like to see an important file at the top of the listing, then choose its name in uppercase— at least, its first letter.
mv
This command renames a file or directory. It can also move a group of files to a directory mv option
-i
-R
wc
• The wc (word count) command counts lines, words, and characters. It takes one or more filenames as its arguments and displays a four-columnar output
cut
you can slice a file vertically with the cut command. cut identifies both columns and fields. We’ll take up columns first.
grep
Use grep to search a file for a pattern and display both matching and nonmatching lines.
head
The head command displays the top of the file. By default, it displays the first 10 lines:
You can use the -n option to specify a line count and display, say, the first three lines of the file:
tail
The tail command displays the bottom of the file. By default, it displays the last 10 lines:
uniq
uniq simply fetches one copy of each line and writes it to the standard output uniq requires a sorted file as inputsort dept.lst | uniq > uniqlist uniq option
-u
-d
-c
cmp
• cmp makes a comparison of each byte of two files and terminates
the moment it encounters a difference:
$ cmp group1 group2
group1 group2 differ: char 47, line 3
If the two files are identical, cmp displays no
message but simply returns the prompt.
touch
touch command: It is used to create a file without any content.
The file created using touch command is empty.
This command tis also used to change the timestamp of existing file
which
• The which command tells you the directory that
• contains the command:
• $ which grep
• /usr/bin/grep
whereis
• Unlike which, which confines its search to the directories in PATH,
whereis looks up a larger list.
whatis
whatis command is used to get a one-line manual page descriptions
who
• Using who to View the List of Current Users The who command displays the following
information for each user currently logged in to the system if no option is provided :
Login name of the users Terminal line numbers Login time of the users in to system Remote host name of the user
whoami
It displays the username of the current user finger
• Finger command is a user information lookup command which gives details of all the users logged in. This tool is generally used by system administrators. It provides details like login name, user name, idle time, login time, and in some cases their email address even.
w
• w command is used to show who is logged on and what they are doing. This command shows the information about the users currently on the machine and their processes.
tty
In Linux, everything is a file. Even any hardware device connected to the system is represented as a special file. Terminal is also represented as a file. Print the file name of the terminal connected to standard input.
uname
• The uname command displays certain features of the operating system running on your machine. By default, it simply displays the name of the operating system:
• The Current Release (-r) A UNIX command often varies across versions so much that you’ll need to use the -r option to find out the version of your operating system:
• The Machine Name (-n) Every machine has a name (the hostname), and if your network is connected to the Internet, this hostname is a component of your machine’s domain name. The -n option tells you the hostname:
ps
Linux provides us a utility called ps for viewing information related with the processes on a system which stands as abbreviation for “Process Status”. ps command is used to list the currently running processes and their PIDs along with some other
information depends on different options. Result contains four columns of information.
PID – the unique process ID
TTY – terminal type that the user is logged into
TIME – amount of CPU in minutes and seconds that the process has been running
CMD – name of the command that launched the process.
history
The history command lets you recall previous commands (even those executed in previous sessions), edit them if required, and re-execute them.
exec
exec command in Linux is used to execute a command from the bash itself. This command does not create a new process it just replaces the bash with the command to be executed. If the exec command is successful, it does not return to the calling process.
kill
kill command in Linux (located in /bin/kill), is a builtin command which is used to terminate processes manually