Skip to content

Commands

command example description
ls ls -la list all content of the directory
sudo sudo -u foo Login as foo
which which id search binary id
command command -v id search binary id
grep grep "foo" search foo in file
shell echo $SHELL show the current shell
echo echo $? status code
cd cd !$ enter in the last command
stderr 2>/dev/null output error )
stdout &>/dev/null all output to /dev/null
disown & disown -a run background
chmod chmod 600 file assignment permissions to file for all
chmod chmod g-x file remove permissions to file for groups
chgrp chgrp group_name /directory change group
chown chown foo:foo foo for foo add foo as owner and foo as group
rm rm -f delete without asking
lsattr lsattr list content with the specials permissions
xargs echo "re" | xargs ls -l paralleled execution
find find / -type f -perm -4000 search the files SUID
find find / -type d -perm -2000 search the directory SGID
find find / -name \ * test search file that start with test in the machine
find find / -user foo -t d search directories of foo user
find find / -executable -type f search executable files
awk awk 'print{$1}' get the first element
awk awk 'NR == 2' filter by secondary line
awk awk '{print $1}' FS=":" filter by argument before ":"
cut cut -d ' ' -f 1 get first element before an inline space
reboot reboot restart machine
apt apt search tmux search the tmux package
ssh sshpass -p "passsss" ssh a@a -p 123 connect with ssh
zip zip -r hello.zip My_directory/ create zip
php php --interactive php in the terminal
ranger ranger menu of the content
xclip xclip -selection clipboard < hello.txt

Note

install with tar.gz tar xvf SDL-1.2.tar.gz cd SDL-1.2 ./configure make sudo make install

tools

gobuster

gobuster -x php,html,pdf      # filter by php,html,pdf

sql

# mariadb
server mysql start
lsof -i:3306
mysql -uroot -p