L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h


Download 7.3 Mb.
Pdf ko'rish
bet29/115
Sana27.10.2023
Hajmi7.3 Mb.
#1728481
1   ...   25   26   27   28   29   30   31   32   ...   115
Bog'liq
linuxbasicsforhackers

Checking Your Login with whoami
In Linux, the one “all-powerful” superuser or system administrator is named 
root, and it has all the system privileges needed to add users, change pass-
words, change privileges, and so on. Obviously, you don’t want just anyone 
to have the ability to make such changes; you want someone who can be 
trusted and has proper knowledge of the operating system. As a hacker, 
you usually need to have all those privileges to run the programs and com-
mands you need (many hacker tools won’t work unless you have root privi-
leges), so you’ll want to log in as root.
If you’ve forgotten whether you’re logged in as root or another user, you 
can use the 
whoami
command to see which user you’re logged in as:
kali >whoami
root
If I had been logged in as another user, such as my personal account, 
whoami
would have returned my username instead, as shown here:
kali >whoami
OTW
Navigating the Linux Filesystem
Navigating the filesystem from the terminal is an essential Linux skill. To 
get anything done, you need to be able to move around to find applications, 
files, and directories located in other directories. In a GUI-based system, 
you can visually see the directories, but when you’re using the command 


Getting Started with the Basics
7
line interface, the structure is entirely text based, and navigating the file-
system means using some commands.
Changing Directories with cd
To change directories from the terminal, use the change directory command, 
cd
. For example, here’s how to change to the /etc directory used to store con-
figuration files:
kali >cd /etc
kali:/etc >
The prompt changes to 
root@kali:/etc
, indicating that we’re in the /etc 
directory. We can confirm this by entering 
pwd
:
kali:/etc >pwd
/etc
To move up one level in the file structure (toward the root of the file 
structure, or /), we use 
cd
followed by double dots (
..
), as shown here:
kali:/etc >cd ..
kali >pwd
/
kali >
This moves us up one level from /etc to the / root directory, but you can 
move up as many levels as you need. Just use the same number of double-
dot pairs as the number of levels you want to move:
• You would use
..
to move up one level.
• You would use 
../..
to move up two levels.
• You would use 
../../..
to move up three levels, and so on.
So, for example, to move up two levels, enter 
cd
followed by two sets of 
double dots with a forward slash in between:
kali >cd ../..
You can also move up to the root level in the file structure from any-
where by entering 
cd /
, where 
/
represents the root of the filesystem.

Download 7.3 Mb.

Do'stlaringiz bilan baham:
1   ...   25   26   27   28   29   30   31   32   ...   115




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling