-
Notifications
You must be signed in to change notification settings - Fork 39
Commands to resolve our problems or to facilitate our IT life :)
Table of Contents
the next command gets the information about the SO
cat /proc/version
get the current state of some variables of the system like CPU and RAM
top
it finds a file with its name
find / -name nombre
get the list of the ports used
netstat -lntu
print the memory ram used in our device
free -m
getting information about the memory and CPU
vmstat
and
top
print the list of users of a system
less /etc/passwd
The idea is to edit the next file when the program that you would like to use, in my case is "pico".
pico ~/.bashrc
you need to add on the final text the alias plus the command that you want to use
finally, execute the next line
. ~/.bashrc
The next command allows us to find the path of a specific file name
find -name "file name"
The idea is to configure the next "interfaces" with the parameters to out internet
sudo pico /etc/network/interfaces
Next, it restarts the interfaces in the SO
sudo /etc/init.d/networking restart
How do I verify if the interface are reachable
ip neigh show
Erase the information in a file text
truncate logfile --size 0
Generally commands... erase, move and copy files.
cp -a /source/. /dest/
rm -r [folder]/*
- Restart your password
The idea is to enter the recovery mode, just only use "shift" before the log screen. When you are there so let's use the next command
mount -n -o remount, rw /
Next, use the next command to restart the password according to the user.
passwd username_here
You can use netstat, with that insert the next code in order to list the process sorted by port
netstat -ano | findstr :8080
with the selected process to kill, write the next line
taskkill /PID typeID /F
The next command allows us to print the name and SID of a SAM in a windows computer(only in a cmd with root privileges)
wmic useraccount get name,sid
Getting the powershell from bash
powershell -ep bypass
How know the list of repository associated to the .git.
git remote -v
Sometimes, it is necessary to save some local changes and update from the master repository in GitHub without to lose the job done, so, it is important first to commit the files that you need to save from the updating process.
git commit [some files]
next, update your local repository from the external changes.
git pull origin master
If you need to change the local email registered, write the next command.
git config --global user.email "you@example.com"
list all databases
\list or \l list all tables in the current database dt
connect to a databse
\connect database_name
execute a sql file in the posgrest environment
psql -f thefile.sql targetdatabase
if you want to delete all the tables in the same squema, so write the next code:
DROP SCHEMA public CASCADE;
To create a new schema:
CREATE SCHEMA public;
if you want to know the postgresql version installed in your environment
SELECT version();
see the view form
\d view
list the docker containers
docker ps
stop one container with its ID
docker stop container_id
get the docker container shell
sudo docker exec -i -t docker-id /bin/bash
erase everything
docker system prune
the next command allows us to list our buckets
aws s3 ls
This will determine if we're in a VM
run post/windows/gather/checkvm
The next command will check for various exploits which we can run within our session to elevate our privileges
run post/multi/recon/local_exploit_suggester