Cheatography
https://cheatography.com
Linux commands useful for a DBA
Basic
man <command name> |
help about the command |
<command A> | <command B> |
send output of A in input to B |
<nomecomando> & |
execute in background |
jobs |
show all the background |
nohub <comando> <filename> |
launch and protect the process |
w |
show the session |
fg %1 |
return to foreground |
cat <filename> |
print the content of file in the terminal |
File navigation and Basic Operations
pwd |
print working directory |
cd <path> |
change driectory to <path> cd ~ |
ls -lrt |
directory file list with details |
touch |
create a file |
mv <path1+filename> <path2> |
move the file in path1 to path2, it can used to rename file |
cp <path1+filename> <path2> |
copy, same as above |
file <filename> |
show the file-type |
ls -lrt <filename> |
details about the file |
stat <filename> |
tail -f |
show last rows of the file and keep update (live mnonitoring) |
vi <filname> |
open the file with vi editor |
File Permission
chmod <nmz> <filename> |
update the file permission |
chown <new owner username> <filename> |
update file owner |
umask |
show default mask |
Main Directories
/etc |
configuration files |
/var/log |
log files |
/tmp |
temp. files |
/home/<user> |
home directory |
which <command name> |
find an executable |
|
|
PC details and monitoring
cat /proc/meminfo |
ram info |
cat /proc/cpuinfo |
cpu info |
lshw |
other info about the PC |
memstat 1 |
real time of values |
vmstat 1 |
Virtual memory stat. |
iostat 1 |
IO metrics, realtime |
iotop |
similar to iostat |
top or htop (if installed) |
show resources |
ipcs -m |
processes shared memory |
Processes
ps -ef |
show processes |
ps aux |
alternative version, useful for mem . info |
top or htop (if installed) |
show resources |
ipcs -m |
processes shared memory |
kill <PID> |
kill a process |
lsof |
tands for LiSt Open Files and shows open files and which process uses them |
lsof -Pp <pid> |
file list used by the process <pid> |
lsof -Pp <pid> | grep log |
search for the log related to <pid> |
Environments
env |
display environments variables |
<variable name> = <var. content> |
set a shell variable |
export <variable name> = <var. content> |
create subshell with env variables |
source <file name> |
akes available the variable in the file for the current shell |
echo ${<variable name>} |
display the variables content |
export <variable name> |
send the variable to the subshells |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets