Skip to content

Instantly share code, notes, and snippets.

@frangeris
Last active April 18, 2018 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save frangeris/8c11b4bd4ef838b0ce79 to your computer and use it in GitHub Desktop.
Save frangeris/8c11b4bd4ef838b0ce79 to your computer and use it in GitHub Desktop.
Fast useful list of linux command
LOCK FILE +, UNLOCK - chattr -i /etc/httpd/conf/httpd.conf
NETWORKING
ifconfig eth0 up
history | grep ifconfig
ifconfig eth0:1 <ip>
tracert <domain>
watch "echo stats | nc 127.0.0.1 11211"
dig <domain> ANY +noall +answer
netstat -a [listening ports]
FILE PERMISSIONS
stat -c "%a %n" <folder> <file>
LINUX VERSION
cat /etc/*-release
cat /etc/redhat-release (YUM)
LINUX KERNEL VERSION
uname -a
NO PING
dhclient -v eth0
WHO'S IP
nmap -O -sS <ip>/24
SCREEN
[CREAR] screen
[LISTA] screen -list
[ENTRA] screen -r <name>
[EXIT] CTRL + a -> d
[REMOVE] screen -X -S <name> quit
[SET NAME] screen -S foo
MYSQL
kill <id_first_column>;
show full processlist;
SHOW PROCESSLIST;
mysqldump --password=<pass> --user=<user> <db_name> <tbl_name> > <filename>.sql;
mysql -p -u <user> <database> < <file>.sql
DISK STATUS
df -h
RAM:
free -m
SERVICES:
ps -aux | grep <php, py, ruby>
FIND
grep -rl "string" <folder>/
USED PORTS netstat -tulnap
lsof -i -P
netstat -tulnp | grep ":<port>"
WHO USE IT fuser <port>/tcp
RSYNC rsync --rsh='ssh -p11052' -aO --progress --ignore-existing --size-only * <user>@<ip>:<destination>
SPACE
du -h <folder, file>
du -sh <folder, file>
du -csh *
du -h --max-depth=1
Link ln -s <target> <link_name>
unlink <symlink>
Errors with files dependencies yum whatprovides <file>
UNBLOCK IP csf -a <IP>
EXCETUTE COMMANDS AS ROOT WITHOUT PASS $visudo <user> ALL=(root) NOPASSWD: <script_location.sh>
Limits in OS ulimit -a
Process per user ps -ef | wc -l
------------------------------------------------------------------------------------------------
Column descriptions top:
PID: A process’s process ID number.
USER: The process’s owner.
PR: The process’s priority. The lower the number, the higher the priority.
NI: The nice value of the process, which affects its priority.
VIRT: How much virtual memory the process is using.
RES: How much physical RAM the process is using, measured in kilobytes.
SHR: How much shared memory the process is using.
S: The current status of the process (zombied, sleeping, running, uninterruptedly sleeping, or traced).
%CPU: The percentage of the processor time used by the process.
%MEM: The percentage of physical RAM used by the process.
TIME+: How much processor time the process has used.
COMMAND: The name of the command that started the process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment