# Command Line Fundamentals

print working directory ; where am I ?

```
pwd
```

which user i am  currently logged in with&#x20;

```
whoami
```

change directory

```
cd
```

&#x20;go up one directory / go back one directory&#x20;

```
cd .. 
```

jump to home dir&#x20;

```
cd ~ 
```

go to last directory&#x20;

```
cd - 
```

&#x20;\[ concept of absolute path and  relative path ]

```
ls 
ls /etc/
ls kali/shark
```

&#x20;security

```
mkdir 
```

security

```
rmdir 
```

&#x20;  to delete recursively&#x20;

```
rm -r shark
```

&#x20;

```
ls  -la
```

create a file named  as hi.txt and put contents  inside quotes  inside it&#x20;

```
echo "hello" > hi.txt 
```

```
cp srcfile dstfile
```

```
mv src dst
```

mv used to rename files as well&#x20;

```
mv 
```

&#x20;is c opy paste&#x20;

```
cp
```

is cut paste&#x20;

```
mv 
```

shark.txt  looks / search eerywhere for specific file name&#x20;

```
locate 
```

&#x20;

```
updatedb
```

to change  password  by default of logged in users&#x20;

```
passwd 
```

passwd shark tochange passwrd of shark nameduser account&#x20;

to read file contents ; cat means to concat

```
cat file1.txt 
```

## Linux file permissions&#x20;

&#x20;

```
rwx rwx rwx
```

r ->4    w-> 2  x->1

```
chmod +r file1.txt
```

```
chmod 777 file1.txt 
```

&#x20; to add new user named shark&#x20;

```
adduser shark
```

Import files :

does not stores  password ; only stores users n account information&#x20;

```
/etc/passwd 
```

stores password in hasehd format look into details of both files&#x20;

```
/etc/shadow 
```
