Show Menu

Linux for DBA - 1 Cheat Sheet by

Linux commands useful for a DBA


man <co­mmand name>
help about the command
<co­mmand A> | <co­mmand B>
send output of A in input to B
<no­mec­oma­ndo> &
execute in background
show all the background
nohub <co­man­do> <fi­len­ame>
launch and protect the process
show the session
fg %1
return to foreground
cat <fi­len­ame>
print the content of file in the terminal

File navigation and Basic Operations

print working directory
cd <pa­th>
change driectory to <pa­th> cd ~
ls -lrt
directory file list with details
create a file
mv <pa­th1­+fi­len­ame> <pa­th2>
move the file in path1 to path2, it can used to rename file
cp <pa­th1­+fi­len­ame> <pa­th2>
copy, same as above
file <fi­len­ame>
show the file-type
ls -lrt <fi­len­ame>
details about the file
stat <fi­len­ame>
tail -f
show last rows of the file and keep update (live mnonit­oring)
vi <fi­lna­me>
open the file with vi editor

File Permission

chmod <nm­z> <fi­len­ame>
update the file permission
chown <new owner userna­me> <fi­len­ame>
update file owner
show default mask

Main Direct­ories

config­uration files
log files
temp. files
home directory
which <co­mmand name>
find an executable

PC details and monitoring

cat /proc/­meminfo
ram info
cat /proc/­cpuinfo
cpu info
other info about the PC
memstat 1
real time of values
vmstat 1
Virtual memory stat.
iostat 1
IO metrics, realtime
similar to iostat
top or htop (if installed)
show resources
ipcs -m
processes shared memory


ps -ef
show processes
ps aux
altern­ative version, useful for mem . info
top or htop (if installed)
show resources
ipcs -m
processes shared memory
kill <PI­D>
kill a process
tands for LiSt Open Files and shows open files and which process uses them
lsof -Pp <pi­d>
file list used by the process <pi­d>
lsof -Pp <pi­d> | grep log
search for the log related to <pi­d>


display enviro­nments variables
<va­riable name> = <var. conten­t>
set a shell variable
export <va­riable name> = <var. conten­t>
create subshell with env variables
source <file name>
akes available the variable in the file for the current shell
echo ${<­var­iable name>}
display the variables content
export <va­riable name>
send the variable to the subshells


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          mod_rewrite Cheat Sheet
          Vim NERDTree Cheat Sheet