Most people like to use an Ubuntu VM on top of VMware in their Windows PC's, I like to use the Ubuntu App in Windows 10 App Store for my networking work.
Because of this app, both my RAM and time are saved. I just need to open it like Windows command prompt and perform Linux tasks right away.
Switch User / Switch User to root
su <username>
su - or sudo su
You will have to give the password for the switching user.
Installing a Package
apt install
You can use -y at the end of the command to say Yes to any dialog there to be appear in installation.
Uninstalling a Package
apt purge
If you specify a wildcard name Ex:- apt purge *impacket* will get rid of everything with impacket.
Go back and forth a directory
cd .. & cd
If the directory is not where you currently in, you should use '/' before the directory name.
Listing items in a directory
ls
See all files in long listing format with read/write capabilities
ls -la
Things starts with dots (.) are hidden files.
Let's analyze the permissions notation of the 1st raw.
The letter sequence drwxr-xr-x stands for permissions.
d means a directory, if a file it will be -
After d, next letters are grouped into 3 letter groups.
In the above example, 1st group 'rwx', 2nd group 'r-x' and the 3rd group is 'r-x'.
Within these 3 letter groups 1st letter is always r = read, 2nd letter is always w = write and the 3rd letter is x = executable. If the particular right is not set it will be marked as a dash -
1st group 'rwx' is for file / directory owner
2nd group 'r-x' is for group owner
3rd group 'r-x' all others
In the above example, group owner can read and execute but cannot write.
Note:-
When you try to execute python scripts etc in networking, they should have executable rights.
Making Permissions to a file or folder
chmod
chmod 777 will make the file rwx to everyone while chmod 755 will permit read and execute access for everyone and also write access for the owner of the file.
chmod +x new.text will make the file executable for everyone
Create a directory
mkdir
Remove an empty directory
rmdir
Remove a non empty directory
rm -rf
Create a new text file with a text
echo
cat
You can view this content in a text editor like nano using nano new.text command.
Copy a file or a folder
cp
Following command will rename the file at destination when you copy..
Moving file or folder
mv
You can see the file is gone from the original location..
Remove a file
rm
Find a file
locate
Newly created files or folders may not be seen by this command until you run updatedb command.
View Interface Configuration
ifconfig
Network Troubleshooting Commands
ping <ip address>
traceroute <ip address>
arp -a
View all the ports that are open and whats connected to that ports
netstat -ano
View Routing Table
route
View command history
history
You can use grep to find a matching command in command history.
Ex:- history | grep ping
Clone a Git Repository
git clone <github link>
Start / Stop Service
service ssh start
service ssh stop
Above commands will start and stop ssh service.
You can view the manual / get help for any command using man <command>
No comments:
Post a Comment