SlideShare a Scribd company logo
1 of 77
Download to read offline
Essential Linux for the SQL
Server DBA
Kellyn Potā€™Vin-Gorman
Technical Intelligence Manager, Delphix
Community
Board President of Rocky Mountain Oracle User Group and for Denver
SQL Server User Group and presenter at 45 technical events annually.
Kellyn Potā€™Vin-Gorman
Deck of ACEs
2018 Idera ACE and Oracle ACE Alumnus and member of Oak Table
Network, a group of Oracle scientists.
Two Decades of Data Management
Managing Oracle, SQL Server, MySQL, Sybase and big data. Current
Technical Intelligence Manager for the Office of CMO for Delphix.
http://dbakevlar.com
@DBAKevlar
https://linkedin/in/kel
lynpotvin
So SQL Server Has Come to the World of Linux
There are tools out there that have been the go-to success for
Oracle DBAs since Linux adoptionā€¦
These utilities provide the information we need to:
ā€¢ Manage the environment
ā€¢ Troubleshoot issues
ā€¢ Gather information
ā€¢ Report on usage
But You Need to Learn to Walk Before You Run..
4
And it Should Never Be Like Thisā€¦
5
Linux
History Lesson
ā€¢ 1991 project by Linux Torvalds from Finland to create free operating system kernel.
ā€¢ Based on C programming
ā€¢ Over 15 million lines of code in base kernel.
ā€¢ Almost was named Freax
ā€¢ Now all part of the GNU Project
ā€¢ Debian, Redhat, Oracle Linux, Ubuntu, Suse are all flavors of Linux.
ā€¢ Microsoft introduces SQL Server on Linux in version 2016
6
User, Groups and Penguins, Oh My!
ā€¢ Donā€™t do everything as ROOT, (aka super user)
ā€¢ Perform administrator tasks by using SUDO, (switch user domain owner)
ā€¢ Log in as with your own user ID and su, (switch user) to the application owner.
ā€¢ There is a UID, (User ID) for every user name.
ā€¢ Each user is assigned a group(s) for role hierarchy
ā€¢ A home directory will contain the following:
ā€¢ Profile, (RC) with environment variables, aliasā€™ and other necessary configurations for the user
environment.
7
RC and Profiles
ā€¢ RC file stands for Run Commands
ā€¢ Profile is similar, but set up as a secondary set of profile settings, including:
ā€¢ Shell to be used
ā€¢ Aliasā€™
ā€¢ Environment variables
ā€¢ Path information
ā€¢ File name begins with a ā€œ.ā€
ā€¢ View with command ls -la
.bashrc
.bash_rc
.profile
.profile_xx
8
Example of a profile
#/! /usr/bin/sh
EDITOR=nano
sudo visudo
export PATH = $PATH:.
# export ORACLE_HOME=/u01/app/oracle/dbhome_1/db12c
export SQL_HOME=/u01/app/mssql/140
export LANG=en.UTF-8
export JAVA_HOME=/usr/bin/java
# alias info
alias reload=ā€™source ~/.bash_profileā€™
alias pre-ā€˜open -a Previewā€™
alias cd.. =ā€™cd ..ā€™
9
Creating Users
ā€¢ Useradd has different results than adduser, but both work.
ā€¢ Useradd will require you to:
ā€¢ Manually update the password with passwd <username>
ā€¢ Manually assign a group with usermod after creating a manual group with groupadd command
ā€¢ If you wish to add any pertinent information about the user, that must be added manually.
A user should be created for every user logging in. Donā€™t share logins.
Avoid non-audited, such as direct ROOT access.
Grant SUDO with great care.
Grant SU to only those that require it.
10
SU and SUDO
ā€¢ To switch to from existing user to become jsmith:
$ su ā€“ jsmith
ā€¢ To execute a command as ROOT after being granted SUDO privileges
$ sudo setsys.sh ā€“y
11
Understanding File Permissions
Where this can be confusing for some, is that we visibly identify the grants by their
values, either as separate values or as totals.
ā€¢ Read,(r)= 4
ā€¢ Write,(w)= 2
ā€¢ Execute, (x)=1
ā€¢ owner has 4+2+1=7
ā€¢ group has 4+2+1=7
ā€¢ other has 4+2+1=7
12
Changing Permissions
ā€¢ CHMOD= change modify
$ chmod <filename> XXX
$ chmod test.txt 764
ā€¢ Owner- read, write, execute
ā€¢ Group- read, write
ā€¢ Other- read
You must have permissions to update the permissions or must SU/SUDO to perform them:
$ sudo chmod test.txt 764
13
Changing File Owner
ā€¢ CHOWN = change owner
$ chown <newuser>:<group> <filename>
$ chown jsmith:dba test.sh
ā€¢ You must have privileges or own the file to begin with to change the ownership.
14
Basics
What Command Common
Change Diretory cd cd, cd .. ,cd /directory path
List or Directory information ls ls, ls ā€“lf, ls ā€“la
Locate program find <program name> find java, find sql
Locate which installation used which <program name> which mssql
Current Directory pwd pwd
Create Directory mkdir mkdir scripts mkdir
/u01/apps/scripts
Create File touch <filename>, vim <filename> touch test.sh
Edit File vim <filename>, vi <filename> vim touch.sh
Remove rm <filename> rm touch.sh
15
Processes
ā€¢ Ps command
$ ps
$ ps ā€“ef
To Kill a process, (BECAREFUL!)
$ kill <PID>
16
Editors
ā€¢ VI/VIM makes you cool- old school
ā€¢ Nano
ā€¢ eMacs
ā€¢ Create a file easily by issuing the touch command
$ touch <filename>
17
VI(M)
Command line editor
$ vi <filename>
ā€¢ Go down a line: j
ā€¢ Go up a line: k
ā€¢ Go to the right: l
ā€¢ Go to the left: h
ā€¢ Insert: i
ā€¢ Append: a
ā€¢ Append to the end of a line: a
ā€¢ Add a line and insert below your cursor:
o
18
Add a line and insert ABOVE your
cursor: <shft> o
Undo: u
Quit without saving: :q
Quit without saving to a read only file:
:q!
Write to a file: :w
Write to a read only file, (override): :w!
Write to a file and quit: :wq
Write to a read only file, (override) and
quit: :wq!
Redirecting Data Output to a File
ā€¢ $ <command> > <filename>
$ ls > filelist.txt
$ ls >> filelist.txt
ā€¢ If run again with the ā€œ>>ā€, the results will be appended to the first fileā€™s contents.
19
Running an Update on Linux
ā€¢ Updates and Installations are done most often via Yum, APT-GET or Zypper
ā€¢ Using APT-GET
ā€¢ Update from repository, (stored in
$ apt-get update
ā€¢ Install updates, (may require SUDO)
$ apt-get install
20
Adding Utilities is Done via Packages
ā€¢ Common Installers for Linux
ā€¢ YUM
ā€¢ APT-GET
ā€¢ ZYPPER
Installing a package with APT-GET
$ sudo apt-get install ā€“y <pkgname>
Viewing package information:
$apt-cache pkgname <pkgname>
Display package information:
$apt-cache show <pkgname>
21
Cheat Sheets for Common Installers
ā€¢ Yum: https://access.redhat.com/articles/yum-cheat-sheet
ā€¢ Apt-Get https://blog.packagecloud.io/eng/2015/03/30/apt-cheat-sheet/
ā€¢ Zypper: https://en.opensuse.org/images/1/17/Zypper-cheat-sheet-1.pdf
22
Mission Impossible
ā€¢ No Powershell
ā€¢ BASH, (Born again shell)
ā€¢ KSHELL, (Korn Shell)
ā€¢ CSHELL, (based off C)
ā€¢ Shell scripting is very similar in each of these languages and very different from
Powershell.
23
Linux system-level diagnostics
ā€¢ CPU and Memory
ā€¢ Process
ā€¢ Network
ā€¢ Traces
ā€¢ Other useful Linux diagnostic utilities
ā€¢ Support recommended diagnostic tools
ā€¢ A great source of living technical information
Utilities to
View
Resource
Usage
ā€¢ SAR
ā€¢ SADC/SADF
ā€¢ MPSTAT
ā€¢ VMSTAT
ā€¢ TOP
25
Common Arguments and Values
ā€¢ Some of the utilities arenā€™t standard and may need to be installed.
ā€¢ Yum and apt-get are your friend
ā€¢ You may require sudo, (super user) privileges to install
ā€¢ <command> -x(xx)
ā€¢ Arguments are cap sensitive, (as is everything in Unix world.)
ā€¢ <command> -x 5 5
ā€¢ First how many second sleep, Second value is how many results to return
ā€¢ <command> -h
ā€¢ Provides help information about the utility or command
26
What is SAR?
ā€¢ System Activity Report
ā€¢ Provides information about
ā€¢ CPU
ā€¢ Memory and virtual memory
ā€¢ I/O
ā€¢ Network
ā€¢ Provided by the SYSSTAT package
ā€¢ What if itā€™s missing?
ā€¢ Install it as root:
$yum -y install sysstat
$apt-get install sysstat
27
sar Utility
ā€¢ CPU utilization: sar -u
ā€¢ %usr, %sys, %idle
ā€¢ %nice
ā€¢ Intervals of CPU: sar 1 3
ā€¢ 3 times, every 1 second
ā€¢ CPU run queue report: sar -q
ā€¢ Runq-sz
ā€¢ plist-sz and load averages
ā€¢ Context switching activity: sar -w
ā€¢ cswch/s
ā€¢ Virtual memory swapping: sar -W
ā€¢ swpin/s, swpot/s
ā€¢ Virtual memory paging: sar -B
ā€¢ pgpgin/s, pgpgot/s
sar Utility
$ sar -u 5 5
Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_ (2 CPU)
06:15:31 PM CPU %user %nice %system %iowait %steal %idle
06:15:36 PM all 0.20 0.00 0.20 48.58 0.00 51.01
06:15:41 PM all 0.30 0.00 0.20 47.98 0.10 51.41
06:15:46 PM all 0.30 0.00 0.20 46.92 0.00 52.58
06:15:51 PM all 0.20 0.00 0.20 47.77 0.00 51.82
06:15:56 PM all 0.20 0.00 0.20 47.78 0.10 51.72
Average: all 0.24 0.00 0.20 47.81 0.04 51.71
sar Utility
$ sar -q 5 5
Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local)
11/28/2017 _x86_64_ (2 CPU)
06:16:45 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15
06:16:50 PM 0 190 1.37 1.28 1.30
06:16:55 PM 0 190 1.34 1.28 1.29
06:17:00 PM 0 190 1.31 1.27 1.29
06:17:05 PM 0 190 1.36 1.29 1.30
06:17:10 PM 0 190 1.34 1.28 1.30
Average: 0 190 1.34 1.28 1.30
What is SADC/SADF?
ā€¢ sadc: back-end system activity data collector utility behind sar
ā€¢ Collects specified system data at configured intervals
ā€¢ Saves data to specified binary files
ā€¢ sadf: system activity data formatter
ā€¢ report on data collected by sadc/sar
ā€¢ output to be consumed by other programs like awk, MS-Excel, etc
ā€¢ Options for translating and displaying dates, numbers, text
ā€¢ Output to plain text or XML
mpstat utility
Processor Level Statisitcs
$ mpstat ā€“P ALL
Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_
(2 CPU)
06:18:10 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
06:18:10 PM all 1.42 0.00 0.19 8.01 0.00 0.00 0.02 0.00 90.36
06:18:10 PM 0 1.38 0.00 0.21 15.10 0.00 0.00 0.02 0.00 83.29
06:18:10 PM 1 1.45 0.00 0.17 0.94 0.00 0.00 0.02 0.00 97.42
vmstat Utility
Virtual Memory Statistics
vmstat 5 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 2 28612 131668 255192 6766272 0 0 0 148 1 3 1 0 90 8 0
0 1 28612 234736 255204 6766424 0 0 24 1480 1485 2737 2 1 48 49 0
0 2 28612 234752 255208 6766536 0 0 0 1511 1365 2632 0 0 50 50 0
1 1 28612 234752 255208 6766664 0 0 0 1399 1353 2626 0 0 50 50 0
0 2 28612 218164 255216 6766784 0 0 18 1310 1337 2591 0 0 49 51 0
top Utility
Tasks: 165 total, 1 running, 164 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.2%sy, 0.0%ni, 53.5%id, 46.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8057984k total, 7827928k used, 230056k free, 255324k buffers
Swap: 311292k total, 28612k used, 282680k free, 6771660k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9888 delphix 20 0 636m 43m 16m S 0.7 0.5 51:40.68 mssql
9892 delphix 20 0 636m 43m 16m D 0.7 0.5 51:18.86 mssql
9886 delphix 20 0 652m 43m 16m S 0.3 0.6 51:19.84 mssql
1 root 20 0 19232 976 820 S 0.0 0.0 0:26.11 delcli
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:09.92 migration/0
What is UPTIME?
ā€¢ uptime displays current time and up-time
ā€¢ Also displays the average number of processes in run-queue over the past 1 minute, 5 minutes, and 15
minutes (a.k.a. load average)
35
uptime and w Utilities
$ uptime
18:20:41 up 41 days, 17 min, 1 user, load average: 1.17, 1.28, 1.30
ā€¢ w displays same info plus info about logged-in UNIX users
$ w
18:21:05 up 41 days, 17 min, 1 user, load average: 1.25, 1.29, 1.30
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
delphix pts/0 c-67-164-182-219 18:05 0.00s 0.02s 0.02s sshd: delphix
[priv]
Process Diagnostics
ā€¢ ps
ā€¢ Process status
ā€¢ pmap
ā€¢ Process mapping
ā€¢ http://dbakevlar.com/2017/12/sql-server-2017-linux-processes/
ā€¢ dstat
ā€¢ Disk, cpu and network monitoring
ā€¢ nmon
ā€¢ Color coded display of cpu, disk and memory statistics
ps Utility
ā€¢ SysV version with many versions and variations:
$ ps -eaf
% ps -aux
# ps ā€“eo opt[,optā€¦]
ā€¢ Provides info about individual processes
ā€¢ Status, PID, PPID, user, command text and parameters
ā€¢ Cumulative and recent CPU usage
ā€¢ Memory (virtual, resident)
ps Utility
ā€¢ An easy home-grown ā€œtopā€ command
$ ps ā€“eaf | sort ā€“n | tail
root 689 2 0 Oct18 ? 00:00:00 [ext4-dio-unwrit]
root 7 2 0 Oct18 ? 00:00:12 [migration/1]
root 723 2 0 Oct18 ? 00:01:34 [kauditd]
root 781 2 0 Oct18 ? 00:00:18 [flush-253:0]
root 8 2 0 Oct18 ? 00:00:00 [stopper/1]
root 9 2 0 Oct18 ? 00:00:06 [ksoftirqd/1]
root 99 2 0 Oct18 ? 00:00:00 [kdmremove]
rpc 1101 1 0 Oct18 ? 00:00:01 rpcbind
ps Utility
ā€¢ Another home-grown ā€œtopā€ command
ā€¢ Also displays memory consumption in Kbytes
$ ps -eo user,pid,pcpu,vsz,rss,comm | sort -n | tail
root 689 0.0 0 0 ext4-dio-unwrit
root 7 0.0 0 0 migration/1
root 723 0.0 0 0 kauditd
root 781 0.0 0 0 flush-253:0
root 8 0.0 0 0 stopper/1
root 9 0.0 0 0 ksoftirqd/1
root 99 0.0 0 0 kdmremove
rpc 1101 0.0 18980 588 rpcbind
ps Utility
ā€¢ Displaying environment variable values within a process
$ ps -eaf | grep jar
delphix 11313 1 0 Oct18 ? 00:23:10 /usr/java/jdk1.7.0_51/bin/java -
Djava.util.logging.config.file=/u02/app/apache-tomcat-7.0.42/conf/logging.properties -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache-
tomcat-7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar -
Dcatalina.base=/u02/app/apache-tomcat-7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 -
Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp org.apache.catalina.startup.Bootstrap
start
$ ps eww 11313
PID TTY STAT TIME COMMAND
11313 ? Sl 23:10 /usr/java/jdk1.7.0_51/bin/java -
Djava.util.logging.config.file=/u02/app/apache-tomcat-7.0.42/conf/logging.properties -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache-
tomcat-7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar -
Dcatalina.base=/u02/app/apache-tomcat-7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 -
Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp org.apache.catalina.startup.Bootstrap
start SHELL=/bin/bash TERM=xterm USER=delphix PATH=/sbin:/usr/sbin:/bin:/usr/bin PWD=/
HOME=/home/delphix SHLVL=3 LOGNAME=delphix _=/usr/java/jdk1.7.0_51/bin/java
CPU/Memory Diagnostics
ā€¢ Use top and/or ps to identify process activity in Linux
ā€¢ By current CPU activity
ā€¢ By total CPU time consumed
ā€¢ By time started
ā€¢ By process name
ā€¢ By UNIX account
ā€¢ By process hierarchy
ā€¢ parent processes, child processes, etc.
pmap Utilities Example
$ pmap -x 11313
11313: /usr/java/jdk1.7.0_51/bin/java -Djava.util.logging.config.file=/u02/app/apache-tomcat-
7.0.42/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache-tomcat-
7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar -Dcatalina.base=/u02/app/apache-tomcat-
7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 -Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp
org.apache.cata
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 4 0 0 r-x-- java
0000000000600000 4 4 4 rw--- java
ā€¦
00007f09de9a6000 4 0 0 r--s- commons-daemon.jar
00007f09de9a7000 4 0 0 r--s- bootstrap.jar
00007f09de9a8000 32 16 12 rw-s- 11313
00007f09de9b3000 4 4 4 r---- ld-2.12.so
00007f09de9b4000 4 4 4 rw--- ld-2.12.so
00007f09de9b5000 4 4 4 rw--- [ anon ]
00007fff04ccb000 84 32 32 rw--- [ stack ]
00007fff04df6000 4 4 0 r-x-- [ anon ]
ffffffffff600000 4 0 0 r-x-- [ anon ]
---------------- ------ ------ ------
total kB 3294068 188964 186976
fuser/lsof Utilities
ā€¢ Displays list of UNIX processes with file handles
$ fuser /u01/app/delphix/oradata/orcl/system01.dbf
/u01/app/delphix/oradata/orcl/system01.dbf: 3801 9343 9349 9351 9353 9355
9357 9359 9911 10082 10084 22879 30148
$ ps -eaf | grep 9357
delphix 9357 1 0 Oct18 ? 00:00:19 ora_reco_orcl ļƒŸbackground
$ ps ā€“eaf | grep 3801
delphix 3801 1 0 Oct22 ? 00:24:20 oracleorcl (LOCAL=NO)
$ ps ā€“eaf | grep 30148
delphix 30148 1 0 Nov22 ? 00:02:04 ora_m002_orcl ļƒŸbackground
fuser/lsof Utilities
ā€¢ Displays list of UNIX processes using file-system
$ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_linuxsource-lv_root
14600800 3135856 10720092 23% /
tmpfs 4028992 0 4028992 0% /dev/shm
/dev/xvda1 487652 132589 329463 29% /boot
/dev/xvdf 30832636 28133056 1126716 97% /u01
/dev/xvdg 20511356 4213904 15248876 22% /u02
$ fuser /dev/xvdf
/dev/xvdf: 727ctm 725ctm 723ctm 722tm 720ctom 633tom
623tom 462o 458o 456o 454o 452o 450o 448o 446o 444o
What is DSTAT?
ā€¢ Monitoring tool for CPU, disk and network activity
ā€¢ Displays ongoing values in interval until q(uit)
ā€¢ To Install:
$ yum install dstat ā€“y
Or
$ sudo apt-get install dstat
46
dstat Utility
47
dstat Utility
ā€¢ Dstat for one disk and only CPU info:
$ dstat -cdl -D xvda1
48
dstat Utility
ā€¢ Monitor Disk Reads
$ dstat -d
49
What is NMON?
50
ā€¢ information dump creation related to cpu, memory, IO or network.
ā€¢ Install:
$ yum install nmon ā€“y
ā€¢ Use menu
ā€¢ q<enter> to quit or
ā€¢ <ctrl> c
nmon CPU
ā€¢ Click C <enter>
51
nmon memory
ā€¢ m<enter>
52
nmon NFS
ā€¢ NFS<enter>
53
fuser/lsof Utilities
ā€¢ Displays list of UNIX processes using file-system
# lsof /var
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
syslogd 350 root 5w VREG 222,5 0 440818 /var/adm/messag
syslogd 350 root 6w VREG 222,5 339098 6248 /var/log/syslog
cron 353 root cwd VDIR 222,5 512 254550 /var -- atjobs
Network Diagnostics
ā€¢ ifconfig
ā€¢ Configure/display network interfaces
$apt-get install -y net-tools
ā€¢ netstat/ss
ā€¢ Display cumulative network statistics
ā€¢ ping
ā€¢ Send ICMP echo packets to network hosts
ā€¢ traceroute
ā€¢ Trace the route of ICMP echo packets to network hosts
ā€¢ tcpdump/snoop
ifconfig Utility
ā€¢ Configures network interfaces
ā€¢ Configure new network interface: ifconfig ā€¦ create inet ā€¦ up
ā€¢ Display network interface status: ifconfig -a
$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 06:8D:24:F2:82:3C
inet addr:10.0.1.20 Bcast:10.0.1.255
Mask:255.255.255.0
inet6 addr: fe80::48d:24ff:fef2:823c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:29480071 errors:0 dropped:0 overruns:0
frame:0
TX packets:26850299 errors:0 dropped:0 overruns:0
carrier:0
collisions:0 txqueuelen:1000
RX bytes:4059464946 (3.7 GiB) TX bytes:9135825067 (8.5
GiB)
Interrupt:153
What is NETSTAT?
ā€¢ Displays network connections, routing tables, interface statistics
ā€¢ Network connections (a.k.a. sockets): netstat
ā€¢ Cumulative networking statistics: netstat -s
ā€¢ Routing tables: netstat -r
ā€¢ STREAMS statistics (Solaris and AIX): netstat -m
ā€¢ Verbose mode: add ā€œ-vā€ switch
netstat Utility
$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 linuxsource:12129 linuxsource:ncube-lm ESTABLISHED
tcp 0 64 linuxsource:ssh c-164-182-219.hsd1:50171 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm ip-10-0-1-10.delphix.:58424 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm landsharkengine.delph:63611 ESTABLISHED
tcp 0 0 linuxsource:ncube-lm linuxsource:12129 ESTABLISHED
udp 0 0 localhost:17493 localhost:17493 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 12 [ ] DGRAM 8754 /dev/log
unix 2 [ ] DGRAM 7377 @/org/kernel/udev/udevd
unix 3 [ ] STREAM CONNECTED 9499
unix 2 [ ] DGRAM 9338
unix 2 [ ] DGRAM 8927
netstat Utility
ā€¢ Display network routing tables on the local host:
$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt
Iface
10.0.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
default 10.0.1.1 0.0.0.0 UG 0 0 0 eth0
What is SS?
ā€¢ SS stands for Socket Statistics
ā€¢ Works like NETSTAT
ā€¢ Gathers info from the kernel via NAD
ā€¢ To install:
$apt-get install iproute2
60
ss Utility
$ ss
$ ss -ltp
61
ping Utility
ā€¢ Simple diagnostic test for network connectivity
ā€¢ Be aware that many network administrator block ICMP traffic for security reasons
$apt-get install iputils.ping
$ ping -c 4 www.amazon.com
PING e15316.ci.akamaiedge.net (104.86.87.164) 56(84) bytes of data.
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=1
ttl=50 time=1.81 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=2
ttl=50 time=1.83 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=3
ttl=50 time=1.99 ms
64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=4
ttl=50 time=1.85 ms
--- e15316.ci.akamaiedge.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.812/1.874/1.994/0.082 ms
What is TRACEROUTE?
ā€¢ Display the route taken by ICMP packets to an IP host
ā€¢ If missing, install using:
$yum install traceroute ā€“y
$apt-get install traceroute -y
63
traceroute Utility
$ traceroute www.amazon.com
traceroute to www.amazon.com (54.192.195.66), 30 hops max, 60 byte packets
1 216.182.225.134 (216.182.225.134) 16.379 ms 216.182.225.124 (216.182.225.124) 49.305 ms
216.182.225.134 (216.182.225.134) 16.347 ms
2 100.66.8.70 (100.66.8.70) 19.966 ms 100.66.8.6 (100.66.8.6) 19.962 ms 100.66.8.250
(100.66.8.250) 14.142 ms
3 100.66.10.46 (100.66.10.46) 21.317 ms 100.66.10.100 (100.66.10.100) 19.104 ms 100.66.11.150
(100.66.11.150) 14.317 ms
4 100.66.7.237 (100.66.7.237) 15.802 ms 100.66.7.183 (100.66.7.183) 16.916 ms 100.66.6.67
(100.66.6.67) 16.800 ms
5 100.66.4.199 (100.66.4.199) 19.609 ms 100.66.4.127 (100.66.4.127) 14.576 ms 100.66.4.151
(100.66.4.151) 11.455 ms
6 100.65.9.65 (100.65.9.65) 0.349 ms 100.65.9.33 (100.65.9.33) 5.948 ms 100.65.9.1 (100.65.9.1)
0.275 ms
7 205.251.244.243 (205.251.244.243) 1.378 ms 72.21.220.120 (72.21.220.120) 1.280 ms 1.333 ms
8 54.239.111.120 (54.239.111.120) 24.074 ms 23.301 ms 54.239.110.22 (54.239.110.22) 37.663 ms
9 54.239.111.183 (54.239.111.183) 1.415 ms 54.239.111.179 (54.239.111.179) 1.234 ms 1.280 ms
10 72.21.220.9 (72.21.220.9) 1.326 ms 1.348 ms 1.391 ms
What is TCPDUMP?
ā€¢ Dump/sniff traffic on a network
ā€¢ Another one that may be missing:
$ yum install tcpdump ā€“y
$ apt-get install tcpdump
65
tcpdump/snoop Utilities
$ tcpdump
tcpdump: listening on hme0
18:56:08.427002 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 529952:530160, ack 3681, win 172, length 208
18:56:08.428001 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 530160:530368, ack 3681, win 172, length 208
18:56:08.429695 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [.], ack 515360, win 256, length 0
18:56:08.429707 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [.], ack 517984, win 252, length 0
18:56:08.429723 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh:
Flags [P.], seq 3681:3745, ack 515568, win 255, length 64
^C18:56:08.429925 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171:
Flags [P.], seq 530368:530960, ack 3745, win 172, length 592
2781 packets captured
2781 packets received by filter
0 packets dropped by kernel
Trace Utilities
ā€¢ Different utilities on different platforms, but for Linux:
ā€¢ strace
ā€¢ Attach to or run a process and then trace:
ā€¢ UNIX system calls executed
ā€¢ Signals received
ā€¢ Machine faults incurred
ā€¢ (optional) entry/exit trace of user level function calls
What is DTRACE?
ā€¢ Performance analysis and troubleshooting tool (http://dtrace.org )
ā€¢ Not just user-level software (i.e. applications, databases and webservers)
ā€¢ also OS kernel and device drivers
ā€¢ provides a language, (i.e. ā€œDā€) for writing DTrace scripts and one-liners
ā€¢ Terrific case-study of I/O performance analysis using DTrace
ā€¢ https://blogs.oracle.com/BestPerf/entry/i_o_analysis_using_dtrace
ā€¢ Installation:
$apt-get install systemtap-sdt-dev
68
dtrace Utility
$ dtrace -n 'proc:::exec-success{printf("%d %sā€,timestamp,curpsinfo-
>pr_psargs);}ā€™
dtrace: description 'proc:::exec-success ' matched 1 probe
CPU ID FUNCTION:NAME
1 797 exec_common:exec-success 21935388676181394 man ls
0 797 exec_common:exec-success 21935388840101743 sh -c cd /usr/share/man;
tbl /usr/sha
1 797 exec_common:exec-success 21935388858652639 col ā€“x
0 797 exec_common:exec-success 21935388863714971 neqn
/usr/share/lib/pub/eqnchar ā€“
0 797 exec_common:exec-success 21935388867119787 tbl
/usr/share/man/man1/ls.1
1 797 exec_common:exec-success 21935388881310626 nroff -u0 -Tlp -man ā€“
file Utility
ā€œFinding Javaā€
$ file /usr/bin/java
/usr/bin/java: symbolic link to `/etc/alternatives/javaā€™
$ file /etc/alternatives/java
/etc/alternatives/java: symbolic link to `/usr/java/jdk1.7.0_51/jre/bin/javaā€™
$ file /usr/java/jdk1.7.0_51/jre/bin/java
/usr/java/jdk1.7.0_51/jre/bin/java: ELF 64-bit LSB executable, x86-64, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
stripped
$ file make_logs.sql
make_logs.sql: ASCII C program text
What is FINDMNT?
ā€¢ A [somewhat] directory tree view of Linux
ā€¢ To Install:
$ yum install findmnt ā€“y
$ apt-get install findmnt
71
findmnt Utility
72
findmnt Utility
ā€¢ findmnt -m
73
What is NCDU?
ā€¢ Quick utility to gather info on space usage in a directory
ā€¢ To install:
$ yum install ncdu ā€“y
$ apt-get install ncdu
Simply execute ncdu command in directory that you wish to gather detailed
file/directory sizes on
74
ncdu Utility
75
Linux for the DBA Summary
ā€¢ Learn to walk before you run
ā€¢ Command line is essential
ā€¢ Utilities are your friends
ā€¢ A few will get you far, choose which ones provide you with what you need.
ā€¢ Build a knowledge of command line editing tools, such as VIM or Nano and Shell
scripting to enhance utilities for full coverage.
ā€¢ Tough at first, but will become second nature- I promise!
76
Thank you!
77

More Related Content

What's hot

Oracle Database on Docker
Oracle Database on DockerOracle Database on Docker
Oracle Database on DockerFranck Pachot
Ā 
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys  How to Build a Successful Microsoft DevOps Including the DataDevOps and Decoys  How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the DataKellyn Pot'Vin-Gorman
Ā 
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShellScott Sutherland
Ā 
Big Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosBig Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosHeiko Loewe
Ā 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under controlMarcin PrzepiĆ³rowski
Ā 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
Ā 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowMatt Ray
Ā 
OpenStack Deployments with Chef
OpenStack Deployments with ChefOpenStack Deployments with Chef
OpenStack Deployments with ChefMatt Ray
Ā 
Chef for OpenStack - OpenStack Fall 2012 Summit
Chef for OpenStack  - OpenStack Fall 2012 SummitChef for OpenStack  - OpenStack Fall 2012 Summit
Chef for OpenStack - OpenStack Fall 2012 SummitMatt Ray
Ā 
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud InfrastructureSCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud InfrastructureMatt Ray
Ā 
Running Oracle Database on Docker
Running Oracle Database on DockerRunning Oracle Database on Docker
Running Oracle Database on Dockergvenzl
Ā 
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12Howard Greenberg
Ā 
Bee con2016 presentation_20160125004_installing
Bee con2016 presentation_20160125004_installingBee con2016 presentation_20160125004_installing
Bee con2016 presentation_20160125004_installingAngel Borroy LĆ³pez
Ā 
HadoopCon- Trend Micro SPN Hadoop Overview
HadoopCon- Trend Micro SPN Hadoop OverviewHadoopCon- Trend Micro SPN Hadoop Overview
HadoopCon- Trend Micro SPN Hadoop OverviewYafang Chang
Ā 
Oracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerOracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerGuatemala User Group
Ā 
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated HadoopHadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated HadoopYafang Chang
Ā 
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCS
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCSOracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCS
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCSFrank Munz
Ā 
Creating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at ScaleCreating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at ScaleSean Chittenden
Ā 
April, 2021 OpenNTF Webinar - Domino Administration Best Practices
April, 2021 OpenNTF Webinar - Domino Administration Best PracticesApril, 2021 OpenNTF Webinar - Domino Administration Best Practices
April, 2021 OpenNTF Webinar - Domino Administration Best PracticesHoward Greenberg
Ā 
Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Guatemala User Group
Ā 

What's hot (20)

Oracle Database on Docker
Oracle Database on DockerOracle Database on Docker
Oracle Database on Docker
Ā 
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys  How to Build a Successful Microsoft DevOps Including the DataDevOps and Decoys  How to Build a Successful Microsoft DevOps Including the Data
DevOps and Decoys How to Build a Successful Microsoft DevOps Including the Data
Ā 
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
Ā 
Big Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosBig Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and Mesos
Ā 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under control
Ā 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
Ā 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
Ā 
OpenStack Deployments with Chef
OpenStack Deployments with ChefOpenStack Deployments with Chef
OpenStack Deployments with Chef
Ā 
Chef for OpenStack - OpenStack Fall 2012 Summit
Chef for OpenStack  - OpenStack Fall 2012 SummitChef for OpenStack  - OpenStack Fall 2012 Summit
Chef for OpenStack - OpenStack Fall 2012 Summit
Ā 
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud InfrastructureSCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
Ā 
Running Oracle Database on Docker
Running Oracle Database on DockerRunning Oracle Database on Docker
Running Oracle Database on Docker
Ā 
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
Ā 
Bee con2016 presentation_20160125004_installing
Bee con2016 presentation_20160125004_installingBee con2016 presentation_20160125004_installing
Bee con2016 presentation_20160125004_installing
Ā 
HadoopCon- Trend Micro SPN Hadoop Overview
HadoopCon- Trend Micro SPN Hadoop OverviewHadoopCon- Trend Micro SPN Hadoop Overview
HadoopCon- Trend Micro SPN Hadoop Overview
Ā 
Oracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with DockerOracle WebLogic Server 12c with Docker
Oracle WebLogic Server 12c with Docker
Ā 
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated HadoopHadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
Ā 
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCS
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCSOracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCS
Oracle CODE 2017 San Francisco: Docker on Raspi Swarm to OCCS
Ā 
Creating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at ScaleCreating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at Scale
Ā 
April, 2021 OpenNTF Webinar - Domino Administration Best Practices
April, 2021 OpenNTF Webinar - Domino Administration Best PracticesApril, 2021 OpenNTF Webinar - Domino Administration Best Practices
April, 2021 OpenNTF Webinar - Domino Administration Best Practices
Ā 
Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination
Ā 

Similar to #WeSpeakLinux Session

Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
Ā 
Open Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsOpen Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsPhase2
Ā 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsPhase2
Ā 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
Ā 
3. introduction of centos
3. introduction of centos3. introduction of centos
3. introduction of centosMohd yasin Karim
Ā 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
Ā 
Environment for training models
Environment for training modelsEnvironment for training models
Environment for training modelsFlyElephant
Ā 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopersBryan Cafferky
Ā 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with AnsibleRicardo Schmidt
Ā 
Ericas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-GuideEricas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-GuideErica StJohn
Ā 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
Ā 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpSander Temme
Ā 
02 Hadoop deployment and configuration
02 Hadoop deployment and configuration02 Hadoop deployment and configuration
02 Hadoop deployment and configurationSubhas Kumar Ghosh
Ā 
Docker
DockerDocker
DockerChen Chun
Ā 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
Ā 
Puppet
PuppetPuppet
Puppetcsrocks
Ā 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSECVic Hargrave
Ā 

Similar to #WeSpeakLinux Session (20)

Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
Ā 
Linux
Linux Linux
Linux
Ā 
Open Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsOpen Source Logging and Metrics Tools
Open Source Logging and Metrics Tools
Ā 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring Tools
Ā 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
Ā 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
Ā 
3. introduction of centos
3. introduction of centos3. introduction of centos
3. introduction of centos
Ā 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
Ā 
Environment for training models
Environment for training modelsEnvironment for training models
Environment for training models
Ā 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
Ā 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
Ā 
Ericas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-GuideEricas-Linux-Plus-Study-Guide
Ericas-Linux-Plus-Study-Guide
Ā 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
Ā 
Osquery
OsqueryOsquery
Osquery
Ā 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
Ā 
02 Hadoop deployment and configuration
02 Hadoop deployment and configuration02 Hadoop deployment and configuration
02 Hadoop deployment and configuration
Ā 
Docker
DockerDocker
Docker
Ā 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
Ā 
Puppet
PuppetPuppet
Puppet
Ā 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSEC
Ā 

More from Kellyn Pot'Vin-Gorman

Redgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxRedgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxKellyn Pot'Vin-Gorman
Ā 
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxSQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxKellyn Pot'Vin-Gorman
Ā 
Boston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxBoston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxKellyn Pot'Vin-Gorman
Ā 
Oracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 UpdateOracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 UpdateKellyn Pot'Vin-Gorman
Ā 
Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"Kellyn Pot'Vin-Gorman
Ā 
How to Win When Migrating to Azure
How to Win When Migrating to AzureHow to Win When Migrating to Azure
How to Win When Migrating to AzureKellyn Pot'Vin-Gorman
Ā 
Cepta The Future of Data with Power BI
Cepta The Future of Data with Power BICepta The Future of Data with Power BI
Cepta The Future of Data with Power BIKellyn Pot'Vin-Gorman
Ā 
Pass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft ProfessionalPass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft ProfessionalKellyn Pot'Vin-Gorman
Ā 
Power BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudPower BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudKellyn Pot'Vin-Gorman
Ā 
ODTUG Leadership Talk- WIT and Sponsorship
ODTUG Leadership Talk-  WIT and SponsorshipODTUG Leadership Talk-  WIT and Sponsorship
ODTUG Leadership Talk- WIT and SponsorshipKellyn Pot'Vin-Gorman
Ā 
Taming the shrew, Optimizing Power BI Options
Taming the shrew, Optimizing Power BI OptionsTaming the shrew, Optimizing Power BI Options
Taming the shrew, Optimizing Power BI OptionsKellyn Pot'Vin-Gorman
Ā 

More from Kellyn Pot'Vin-Gorman (20)

Redgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptxRedgate_summit_atl_kgorman_intersection.pptx
Redgate_summit_atl_kgorman_intersection.pptx
Ā 
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptxSQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
SQLSatOregon_kgorman_keynote_NIAIMLEC.pptx
Ā 
Boston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxBoston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptx
Ā 
Oracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 UpdateOracle on Azure IaaS 2023 Update
Oracle on Azure IaaS 2023 Update
Ā 
IaaS for DBAs in Azure
IaaS for DBAs in AzureIaaS for DBAs in Azure
IaaS for DBAs in Azure
Ā 
Being Successful with ADHD
Being Successful with ADHDBeing Successful with ADHD
Being Successful with ADHD
Ā 
Azure DBA with IaaS
Azure DBA with IaaSAzure DBA with IaaS
Azure DBA with IaaS
Ā 
Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"Turning ADHD into "Awesome Dynamic Highly Dependable"
Turning ADHD into "Awesome Dynamic Highly Dependable"
Ā 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
Ā 
DevOps in Silos
DevOps in SilosDevOps in Silos
DevOps in Silos
Ā 
Azure Databases with IaaS
Azure Databases with IaaSAzure Databases with IaaS
Azure Databases with IaaS
Ā 
How to Win When Migrating to Azure
How to Win When Migrating to AzureHow to Win When Migrating to Azure
How to Win When Migrating to Azure
Ā 
Securing Power BI Data
Securing Power BI DataSecuring Power BI Data
Securing Power BI Data
Ā 
Cepta The Future of Data with Power BI
Cepta The Future of Data with Power BICepta The Future of Data with Power BI
Cepta The Future of Data with Power BI
Ā 
Pass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft ProfessionalPass Summit Linux Scripting for the Microsoft Professional
Pass Summit Linux Scripting for the Microsoft Professional
Ā 
Taming the shrew Power BI
Taming the shrew Power BITaming the shrew Power BI
Taming the shrew Power BI
Ā 
Power BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudPower BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle Cloud
Ā 
ODTUG Leadership Talk- WIT and Sponsorship
ODTUG Leadership Talk-  WIT and SponsorshipODTUG Leadership Talk-  WIT and Sponsorship
ODTUG Leadership Talk- WIT and Sponsorship
Ā 
GDPR- The Buck Stops Here
GDPR-  The Buck Stops HereGDPR-  The Buck Stops Here
GDPR- The Buck Stops Here
Ā 
Taming the shrew, Optimizing Power BI Options
Taming the shrew, Optimizing Power BI OptionsTaming the shrew, Optimizing Power BI Options
Taming the shrew, Optimizing Power BI Options
Ā 

Recently uploaded

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
Ā 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
Ā 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vƔzquez
Ā 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
Ā 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
Ā 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
Ā 
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelDeepika Singh
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
Ā 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
Ā 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Ā 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Ā 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
Ā 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Ā 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Ā 
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Ā 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Ā 

#WeSpeakLinux Session

  • 1. Essential Linux for the SQL Server DBA Kellyn Potā€™Vin-Gorman Technical Intelligence Manager, Delphix
  • 2. Community Board President of Rocky Mountain Oracle User Group and for Denver SQL Server User Group and presenter at 45 technical events annually. Kellyn Potā€™Vin-Gorman Deck of ACEs 2018 Idera ACE and Oracle ACE Alumnus and member of Oak Table Network, a group of Oracle scientists. Two Decades of Data Management Managing Oracle, SQL Server, MySQL, Sybase and big data. Current Technical Intelligence Manager for the Office of CMO for Delphix. http://dbakevlar.com @DBAKevlar https://linkedin/in/kel lynpotvin
  • 3. So SQL Server Has Come to the World of Linux There are tools out there that have been the go-to success for Oracle DBAs since Linux adoptionā€¦ These utilities provide the information we need to: ā€¢ Manage the environment ā€¢ Troubleshoot issues ā€¢ Gather information ā€¢ Report on usage
  • 4. But You Need to Learn to Walk Before You Run.. 4
  • 5. And it Should Never Be Like Thisā€¦ 5 Linux
  • 6. History Lesson ā€¢ 1991 project by Linux Torvalds from Finland to create free operating system kernel. ā€¢ Based on C programming ā€¢ Over 15 million lines of code in base kernel. ā€¢ Almost was named Freax ā€¢ Now all part of the GNU Project ā€¢ Debian, Redhat, Oracle Linux, Ubuntu, Suse are all flavors of Linux. ā€¢ Microsoft introduces SQL Server on Linux in version 2016 6
  • 7. User, Groups and Penguins, Oh My! ā€¢ Donā€™t do everything as ROOT, (aka super user) ā€¢ Perform administrator tasks by using SUDO, (switch user domain owner) ā€¢ Log in as with your own user ID and su, (switch user) to the application owner. ā€¢ There is a UID, (User ID) for every user name. ā€¢ Each user is assigned a group(s) for role hierarchy ā€¢ A home directory will contain the following: ā€¢ Profile, (RC) with environment variables, aliasā€™ and other necessary configurations for the user environment. 7
  • 8. RC and Profiles ā€¢ RC file stands for Run Commands ā€¢ Profile is similar, but set up as a secondary set of profile settings, including: ā€¢ Shell to be used ā€¢ Aliasā€™ ā€¢ Environment variables ā€¢ Path information ā€¢ File name begins with a ā€œ.ā€ ā€¢ View with command ls -la .bashrc .bash_rc .profile .profile_xx 8
  • 9. Example of a profile #/! /usr/bin/sh EDITOR=nano sudo visudo export PATH = $PATH:. # export ORACLE_HOME=/u01/app/oracle/dbhome_1/db12c export SQL_HOME=/u01/app/mssql/140 export LANG=en.UTF-8 export JAVA_HOME=/usr/bin/java # alias info alias reload=ā€™source ~/.bash_profileā€™ alias pre-ā€˜open -a Previewā€™ alias cd.. =ā€™cd ..ā€™ 9
  • 10. Creating Users ā€¢ Useradd has different results than adduser, but both work. ā€¢ Useradd will require you to: ā€¢ Manually update the password with passwd <username> ā€¢ Manually assign a group with usermod after creating a manual group with groupadd command ā€¢ If you wish to add any pertinent information about the user, that must be added manually. A user should be created for every user logging in. Donā€™t share logins. Avoid non-audited, such as direct ROOT access. Grant SUDO with great care. Grant SU to only those that require it. 10
  • 11. SU and SUDO ā€¢ To switch to from existing user to become jsmith: $ su ā€“ jsmith ā€¢ To execute a command as ROOT after being granted SUDO privileges $ sudo setsys.sh ā€“y 11
  • 12. Understanding File Permissions Where this can be confusing for some, is that we visibly identify the grants by their values, either as separate values or as totals. ā€¢ Read,(r)= 4 ā€¢ Write,(w)= 2 ā€¢ Execute, (x)=1 ā€¢ owner has 4+2+1=7 ā€¢ group has 4+2+1=7 ā€¢ other has 4+2+1=7 12
  • 13. Changing Permissions ā€¢ CHMOD= change modify $ chmod <filename> XXX $ chmod test.txt 764 ā€¢ Owner- read, write, execute ā€¢ Group- read, write ā€¢ Other- read You must have permissions to update the permissions or must SU/SUDO to perform them: $ sudo chmod test.txt 764 13
  • 14. Changing File Owner ā€¢ CHOWN = change owner $ chown <newuser>:<group> <filename> $ chown jsmith:dba test.sh ā€¢ You must have privileges or own the file to begin with to change the ownership. 14
  • 15. Basics What Command Common Change Diretory cd cd, cd .. ,cd /directory path List or Directory information ls ls, ls ā€“lf, ls ā€“la Locate program find <program name> find java, find sql Locate which installation used which <program name> which mssql Current Directory pwd pwd Create Directory mkdir mkdir scripts mkdir /u01/apps/scripts Create File touch <filename>, vim <filename> touch test.sh Edit File vim <filename>, vi <filename> vim touch.sh Remove rm <filename> rm touch.sh 15
  • 16. Processes ā€¢ Ps command $ ps $ ps ā€“ef To Kill a process, (BECAREFUL!) $ kill <PID> 16
  • 17. Editors ā€¢ VI/VIM makes you cool- old school ā€¢ Nano ā€¢ eMacs ā€¢ Create a file easily by issuing the touch command $ touch <filename> 17
  • 18. VI(M) Command line editor $ vi <filename> ā€¢ Go down a line: j ā€¢ Go up a line: k ā€¢ Go to the right: l ā€¢ Go to the left: h ā€¢ Insert: i ā€¢ Append: a ā€¢ Append to the end of a line: a ā€¢ Add a line and insert below your cursor: o 18 Add a line and insert ABOVE your cursor: <shft> o Undo: u Quit without saving: :q Quit without saving to a read only file: :q! Write to a file: :w Write to a read only file, (override): :w! Write to a file and quit: :wq Write to a read only file, (override) and quit: :wq!
  • 19. Redirecting Data Output to a File ā€¢ $ <command> > <filename> $ ls > filelist.txt $ ls >> filelist.txt ā€¢ If run again with the ā€œ>>ā€, the results will be appended to the first fileā€™s contents. 19
  • 20. Running an Update on Linux ā€¢ Updates and Installations are done most often via Yum, APT-GET or Zypper ā€¢ Using APT-GET ā€¢ Update from repository, (stored in $ apt-get update ā€¢ Install updates, (may require SUDO) $ apt-get install 20
  • 21. Adding Utilities is Done via Packages ā€¢ Common Installers for Linux ā€¢ YUM ā€¢ APT-GET ā€¢ ZYPPER Installing a package with APT-GET $ sudo apt-get install ā€“y <pkgname> Viewing package information: $apt-cache pkgname <pkgname> Display package information: $apt-cache show <pkgname> 21
  • 22. Cheat Sheets for Common Installers ā€¢ Yum: https://access.redhat.com/articles/yum-cheat-sheet ā€¢ Apt-Get https://blog.packagecloud.io/eng/2015/03/30/apt-cheat-sheet/ ā€¢ Zypper: https://en.opensuse.org/images/1/17/Zypper-cheat-sheet-1.pdf 22
  • 23. Mission Impossible ā€¢ No Powershell ā€¢ BASH, (Born again shell) ā€¢ KSHELL, (Korn Shell) ā€¢ CSHELL, (based off C) ā€¢ Shell scripting is very similar in each of these languages and very different from Powershell. 23
  • 24. Linux system-level diagnostics ā€¢ CPU and Memory ā€¢ Process ā€¢ Network ā€¢ Traces ā€¢ Other useful Linux diagnostic utilities ā€¢ Support recommended diagnostic tools ā€¢ A great source of living technical information
  • 25. Utilities to View Resource Usage ā€¢ SAR ā€¢ SADC/SADF ā€¢ MPSTAT ā€¢ VMSTAT ā€¢ TOP 25
  • 26. Common Arguments and Values ā€¢ Some of the utilities arenā€™t standard and may need to be installed. ā€¢ Yum and apt-get are your friend ā€¢ You may require sudo, (super user) privileges to install ā€¢ <command> -x(xx) ā€¢ Arguments are cap sensitive, (as is everything in Unix world.) ā€¢ <command> -x 5 5 ā€¢ First how many second sleep, Second value is how many results to return ā€¢ <command> -h ā€¢ Provides help information about the utility or command 26
  • 27. What is SAR? ā€¢ System Activity Report ā€¢ Provides information about ā€¢ CPU ā€¢ Memory and virtual memory ā€¢ I/O ā€¢ Network ā€¢ Provided by the SYSSTAT package ā€¢ What if itā€™s missing? ā€¢ Install it as root: $yum -y install sysstat $apt-get install sysstat 27
  • 28. sar Utility ā€¢ CPU utilization: sar -u ā€¢ %usr, %sys, %idle ā€¢ %nice ā€¢ Intervals of CPU: sar 1 3 ā€¢ 3 times, every 1 second ā€¢ CPU run queue report: sar -q ā€¢ Runq-sz ā€¢ plist-sz and load averages ā€¢ Context switching activity: sar -w ā€¢ cswch/s ā€¢ Virtual memory swapping: sar -W ā€¢ swpin/s, swpot/s ā€¢ Virtual memory paging: sar -B ā€¢ pgpgin/s, pgpgot/s
  • 29. sar Utility $ sar -u 5 5 Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_ (2 CPU) 06:15:31 PM CPU %user %nice %system %iowait %steal %idle 06:15:36 PM all 0.20 0.00 0.20 48.58 0.00 51.01 06:15:41 PM all 0.30 0.00 0.20 47.98 0.10 51.41 06:15:46 PM all 0.30 0.00 0.20 46.92 0.00 52.58 06:15:51 PM all 0.20 0.00 0.20 47.77 0.00 51.82 06:15:56 PM all 0.20 0.00 0.20 47.78 0.10 51.72 Average: all 0.24 0.00 0.20 47.81 0.04 51.71
  • 30. sar Utility $ sar -q 5 5 Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_ (2 CPU) 06:16:45 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 06:16:50 PM 0 190 1.37 1.28 1.30 06:16:55 PM 0 190 1.34 1.28 1.29 06:17:00 PM 0 190 1.31 1.27 1.29 06:17:05 PM 0 190 1.36 1.29 1.30 06:17:10 PM 0 190 1.34 1.28 1.30 Average: 0 190 1.34 1.28 1.30
  • 31. What is SADC/SADF? ā€¢ sadc: back-end system activity data collector utility behind sar ā€¢ Collects specified system data at configured intervals ā€¢ Saves data to specified binary files ā€¢ sadf: system activity data formatter ā€¢ report on data collected by sadc/sar ā€¢ output to be consumed by other programs like awk, MS-Excel, etc ā€¢ Options for translating and displaying dates, numbers, text ā€¢ Output to plain text or XML
  • 32. mpstat utility Processor Level Statisitcs $ mpstat ā€“P ALL Linux 2.6.32-573.22.1.el6.x86_64 (linuxsource.delphix.local) 11/28/2017 _x86_64_ (2 CPU) 06:18:10 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 06:18:10 PM all 1.42 0.00 0.19 8.01 0.00 0.00 0.02 0.00 90.36 06:18:10 PM 0 1.38 0.00 0.21 15.10 0.00 0.00 0.02 0.00 83.29 06:18:10 PM 1 1.45 0.00 0.17 0.94 0.00 0.00 0.02 0.00 97.42
  • 33. vmstat Utility Virtual Memory Statistics vmstat 5 5 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 2 28612 131668 255192 6766272 0 0 0 148 1 3 1 0 90 8 0 0 1 28612 234736 255204 6766424 0 0 24 1480 1485 2737 2 1 48 49 0 0 2 28612 234752 255208 6766536 0 0 0 1511 1365 2632 0 0 50 50 0 1 1 28612 234752 255208 6766664 0 0 0 1399 1353 2626 0 0 50 50 0 0 2 28612 218164 255216 6766784 0 0 18 1310 1337 2591 0 0 49 51 0
  • 34. top Utility Tasks: 165 total, 1 running, 164 sleeping, 0 stopped, 0 zombie Cpu(s): 0.3%us, 0.2%sy, 0.0%ni, 53.5%id, 46.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8057984k total, 7827928k used, 230056k free, 255324k buffers Swap: 311292k total, 28612k used, 282680k free, 6771660k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9888 delphix 20 0 636m 43m 16m S 0.7 0.5 51:40.68 mssql 9892 delphix 20 0 636m 43m 16m D 0.7 0.5 51:18.86 mssql 9886 delphix 20 0 652m 43m 16m S 0.3 0.6 51:19.84 mssql 1 root 20 0 19232 976 820 S 0.0 0.0 0:26.11 delcli 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root RT 0 0 0 0 S 0.0 0.0 0:09.92 migration/0
  • 35. What is UPTIME? ā€¢ uptime displays current time and up-time ā€¢ Also displays the average number of processes in run-queue over the past 1 minute, 5 minutes, and 15 minutes (a.k.a. load average) 35
  • 36. uptime and w Utilities $ uptime 18:20:41 up 41 days, 17 min, 1 user, load average: 1.17, 1.28, 1.30 ā€¢ w displays same info plus info about logged-in UNIX users $ w 18:21:05 up 41 days, 17 min, 1 user, load average: 1.25, 1.29, 1.30 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT delphix pts/0 c-67-164-182-219 18:05 0.00s 0.02s 0.02s sshd: delphix [priv]
  • 37. Process Diagnostics ā€¢ ps ā€¢ Process status ā€¢ pmap ā€¢ Process mapping ā€¢ http://dbakevlar.com/2017/12/sql-server-2017-linux-processes/ ā€¢ dstat ā€¢ Disk, cpu and network monitoring ā€¢ nmon ā€¢ Color coded display of cpu, disk and memory statistics
  • 38. ps Utility ā€¢ SysV version with many versions and variations: $ ps -eaf % ps -aux # ps ā€“eo opt[,optā€¦] ā€¢ Provides info about individual processes ā€¢ Status, PID, PPID, user, command text and parameters ā€¢ Cumulative and recent CPU usage ā€¢ Memory (virtual, resident)
  • 39. ps Utility ā€¢ An easy home-grown ā€œtopā€ command $ ps ā€“eaf | sort ā€“n | tail root 689 2 0 Oct18 ? 00:00:00 [ext4-dio-unwrit] root 7 2 0 Oct18 ? 00:00:12 [migration/1] root 723 2 0 Oct18 ? 00:01:34 [kauditd] root 781 2 0 Oct18 ? 00:00:18 [flush-253:0] root 8 2 0 Oct18 ? 00:00:00 [stopper/1] root 9 2 0 Oct18 ? 00:00:06 [ksoftirqd/1] root 99 2 0 Oct18 ? 00:00:00 [kdmremove] rpc 1101 1 0 Oct18 ? 00:00:01 rpcbind
  • 40. ps Utility ā€¢ Another home-grown ā€œtopā€ command ā€¢ Also displays memory consumption in Kbytes $ ps -eo user,pid,pcpu,vsz,rss,comm | sort -n | tail root 689 0.0 0 0 ext4-dio-unwrit root 7 0.0 0 0 migration/1 root 723 0.0 0 0 kauditd root 781 0.0 0 0 flush-253:0 root 8 0.0 0 0 stopper/1 root 9 0.0 0 0 ksoftirqd/1 root 99 0.0 0 0 kdmremove rpc 1101 0.0 18980 588 rpcbind
  • 41. ps Utility ā€¢ Displaying environment variable values within a process $ ps -eaf | grep jar delphix 11313 1 0 Oct18 ? 00:23:10 /usr/java/jdk1.7.0_51/bin/java - Djava.util.logging.config.file=/u02/app/apache-tomcat-7.0.42/conf/logging.properties - Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache- tomcat-7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar - Dcatalina.base=/u02/app/apache-tomcat-7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 - Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp org.apache.catalina.startup.Bootstrap start $ ps eww 11313 PID TTY STAT TIME COMMAND 11313 ? Sl 23:10 /usr/java/jdk1.7.0_51/bin/java - Djava.util.logging.config.file=/u02/app/apache-tomcat-7.0.42/conf/logging.properties - Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache- tomcat-7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar - Dcatalina.base=/u02/app/apache-tomcat-7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 - Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp org.apache.catalina.startup.Bootstrap start SHELL=/bin/bash TERM=xterm USER=delphix PATH=/sbin:/usr/sbin:/bin:/usr/bin PWD=/ HOME=/home/delphix SHLVL=3 LOGNAME=delphix _=/usr/java/jdk1.7.0_51/bin/java
  • 42. CPU/Memory Diagnostics ā€¢ Use top and/or ps to identify process activity in Linux ā€¢ By current CPU activity ā€¢ By total CPU time consumed ā€¢ By time started ā€¢ By process name ā€¢ By UNIX account ā€¢ By process hierarchy ā€¢ parent processes, child processes, etc.
  • 43. pmap Utilities Example $ pmap -x 11313 11313: /usr/java/jdk1.7.0_51/bin/java -Djava.util.logging.config.file=/u02/app/apache-tomcat- 7.0.42/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djava.endorsed.dirs=/u02/app/apache-tomcat-7.0.42/endorsed -classpath /u02/app/apache-tomcat- 7.0.42/bin/bootstrap.jar:/u02/app/apache-tomcat-7.0.42/bin/tomcat-juli.jar -Dcatalina.base=/u02/app/apache-tomcat- 7.0.42 -Dcatalina.home=/u02/app/apache-tomcat-7.0.42 -Djava.io.tmpdir=/u02/app/apache-tomcat-7.0.42/temp org.apache.cata Address Kbytes RSS Dirty Mode Mapping 0000000000400000 4 0 0 r-x-- java 0000000000600000 4 4 4 rw--- java ā€¦ 00007f09de9a6000 4 0 0 r--s- commons-daemon.jar 00007f09de9a7000 4 0 0 r--s- bootstrap.jar 00007f09de9a8000 32 16 12 rw-s- 11313 00007f09de9b3000 4 4 4 r---- ld-2.12.so 00007f09de9b4000 4 4 4 rw--- ld-2.12.so 00007f09de9b5000 4 4 4 rw--- [ anon ] 00007fff04ccb000 84 32 32 rw--- [ stack ] 00007fff04df6000 4 4 0 r-x-- [ anon ] ffffffffff600000 4 0 0 r-x-- [ anon ] ---------------- ------ ------ ------ total kB 3294068 188964 186976
  • 44. fuser/lsof Utilities ā€¢ Displays list of UNIX processes with file handles $ fuser /u01/app/delphix/oradata/orcl/system01.dbf /u01/app/delphix/oradata/orcl/system01.dbf: 3801 9343 9349 9351 9353 9355 9357 9359 9911 10082 10084 22879 30148 $ ps -eaf | grep 9357 delphix 9357 1 0 Oct18 ? 00:00:19 ora_reco_orcl ļƒŸbackground $ ps ā€“eaf | grep 3801 delphix 3801 1 0 Oct22 ? 00:24:20 oracleorcl (LOCAL=NO) $ ps ā€“eaf | grep 30148 delphix 30148 1 0 Nov22 ? 00:02:04 ora_m002_orcl ļƒŸbackground
  • 45. fuser/lsof Utilities ā€¢ Displays list of UNIX processes using file-system $ df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_linuxsource-lv_root 14600800 3135856 10720092 23% / tmpfs 4028992 0 4028992 0% /dev/shm /dev/xvda1 487652 132589 329463 29% /boot /dev/xvdf 30832636 28133056 1126716 97% /u01 /dev/xvdg 20511356 4213904 15248876 22% /u02 $ fuser /dev/xvdf /dev/xvdf: 727ctm 725ctm 723ctm 722tm 720ctom 633tom 623tom 462o 458o 456o 454o 452o 450o 448o 446o 444o
  • 46. What is DSTAT? ā€¢ Monitoring tool for CPU, disk and network activity ā€¢ Displays ongoing values in interval until q(uit) ā€¢ To Install: $ yum install dstat ā€“y Or $ sudo apt-get install dstat 46
  • 48. dstat Utility ā€¢ Dstat for one disk and only CPU info: $ dstat -cdl -D xvda1 48
  • 49. dstat Utility ā€¢ Monitor Disk Reads $ dstat -d 49
  • 50. What is NMON? 50 ā€¢ information dump creation related to cpu, memory, IO or network. ā€¢ Install: $ yum install nmon ā€“y ā€¢ Use menu ā€¢ q<enter> to quit or ā€¢ <ctrl> c
  • 51. nmon CPU ā€¢ Click C <enter> 51
  • 54. fuser/lsof Utilities ā€¢ Displays list of UNIX processes using file-system # lsof /var COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME syslogd 350 root 5w VREG 222,5 0 440818 /var/adm/messag syslogd 350 root 6w VREG 222,5 339098 6248 /var/log/syslog cron 353 root cwd VDIR 222,5 512 254550 /var -- atjobs
  • 55. Network Diagnostics ā€¢ ifconfig ā€¢ Configure/display network interfaces $apt-get install -y net-tools ā€¢ netstat/ss ā€¢ Display cumulative network statistics ā€¢ ping ā€¢ Send ICMP echo packets to network hosts ā€¢ traceroute ā€¢ Trace the route of ICMP echo packets to network hosts ā€¢ tcpdump/snoop
  • 56. ifconfig Utility ā€¢ Configures network interfaces ā€¢ Configure new network interface: ifconfig ā€¦ create inet ā€¦ up ā€¢ Display network interface status: ifconfig -a $ ifconfig -a eth0 Link encap:Ethernet HWaddr 06:8D:24:F2:82:3C inet addr:10.0.1.20 Bcast:10.0.1.255 Mask:255.255.255.0 inet6 addr: fe80::48d:24ff:fef2:823c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1 RX packets:29480071 errors:0 dropped:0 overruns:0 frame:0 TX packets:26850299 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4059464946 (3.7 GiB) TX bytes:9135825067 (8.5 GiB) Interrupt:153
  • 57. What is NETSTAT? ā€¢ Displays network connections, routing tables, interface statistics ā€¢ Network connections (a.k.a. sockets): netstat ā€¢ Cumulative networking statistics: netstat -s ā€¢ Routing tables: netstat -r ā€¢ STREAMS statistics (Solaris and AIX): netstat -m ā€¢ Verbose mode: add ā€œ-vā€ switch
  • 58. netstat Utility $ netstat Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 linuxsource:12129 linuxsource:ncube-lm ESTABLISHED tcp 0 64 linuxsource:ssh c-164-182-219.hsd1:50171 ESTABLISHED tcp 0 0 linuxsource:ncube-lm ip-10-0-1-10.delphix.:58424 ESTABLISHED tcp 0 0 linuxsource:ncube-lm landsharkengine.delph:63611 ESTABLISHED tcp 0 0 linuxsource:ncube-lm linuxsource:12129 ESTABLISHED udp 0 0 localhost:17493 localhost:17493 ESTABLISHED Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 12 [ ] DGRAM 8754 /dev/log unix 2 [ ] DGRAM 7377 @/org/kernel/udev/udevd unix 3 [ ] STREAM CONNECTED 9499 unix 2 [ ] DGRAM 9338 unix 2 [ ] DGRAM 8927
  • 59. netstat Utility ā€¢ Display network routing tables on the local host: $ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.0.1.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 default 10.0.1.1 0.0.0.0 UG 0 0 0 eth0
  • 60. What is SS? ā€¢ SS stands for Socket Statistics ā€¢ Works like NETSTAT ā€¢ Gathers info from the kernel via NAD ā€¢ To install: $apt-get install iproute2 60
  • 61. ss Utility $ ss $ ss -ltp 61
  • 62. ping Utility ā€¢ Simple diagnostic test for network connectivity ā€¢ Be aware that many network administrator block ICMP traffic for security reasons $apt-get install iputils.ping $ ping -c 4 www.amazon.com PING e15316.ci.akamaiedge.net (104.86.87.164) 56(84) bytes of data. 64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=1 ttl=50 time=1.81 ms 64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=2 ttl=50 time=1.83 ms 64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=3 ttl=50 time=1.99 ms 64 bytes from a104-86-87-164.deploy.static.akamaitechnologies.com (104.86.87.164): icmp_seq=4 ttl=50 time=1.85 ms --- e15316.ci.akamaiedge.net ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 1.812/1.874/1.994/0.082 ms
  • 63. What is TRACEROUTE? ā€¢ Display the route taken by ICMP packets to an IP host ā€¢ If missing, install using: $yum install traceroute ā€“y $apt-get install traceroute -y 63
  • 64. traceroute Utility $ traceroute www.amazon.com traceroute to www.amazon.com (54.192.195.66), 30 hops max, 60 byte packets 1 216.182.225.134 (216.182.225.134) 16.379 ms 216.182.225.124 (216.182.225.124) 49.305 ms 216.182.225.134 (216.182.225.134) 16.347 ms 2 100.66.8.70 (100.66.8.70) 19.966 ms 100.66.8.6 (100.66.8.6) 19.962 ms 100.66.8.250 (100.66.8.250) 14.142 ms 3 100.66.10.46 (100.66.10.46) 21.317 ms 100.66.10.100 (100.66.10.100) 19.104 ms 100.66.11.150 (100.66.11.150) 14.317 ms 4 100.66.7.237 (100.66.7.237) 15.802 ms 100.66.7.183 (100.66.7.183) 16.916 ms 100.66.6.67 (100.66.6.67) 16.800 ms 5 100.66.4.199 (100.66.4.199) 19.609 ms 100.66.4.127 (100.66.4.127) 14.576 ms 100.66.4.151 (100.66.4.151) 11.455 ms 6 100.65.9.65 (100.65.9.65) 0.349 ms 100.65.9.33 (100.65.9.33) 5.948 ms 100.65.9.1 (100.65.9.1) 0.275 ms 7 205.251.244.243 (205.251.244.243) 1.378 ms 72.21.220.120 (72.21.220.120) 1.280 ms 1.333 ms 8 54.239.111.120 (54.239.111.120) 24.074 ms 23.301 ms 54.239.110.22 (54.239.110.22) 37.663 ms 9 54.239.111.183 (54.239.111.183) 1.415 ms 54.239.111.179 (54.239.111.179) 1.234 ms 1.280 ms 10 72.21.220.9 (72.21.220.9) 1.326 ms 1.348 ms 1.391 ms
  • 65. What is TCPDUMP? ā€¢ Dump/sniff traffic on a network ā€¢ Another one that may be missing: $ yum install tcpdump ā€“y $ apt-get install tcpdump 65
  • 66. tcpdump/snoop Utilities $ tcpdump tcpdump: listening on hme0 18:56:08.427002 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171: Flags [P.], seq 529952:530160, ack 3681, win 172, length 208 18:56:08.428001 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171: Flags [P.], seq 530160:530368, ack 3681, win 172, length 208 18:56:08.429695 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh: Flags [.], ack 515360, win 256, length 0 18:56:08.429707 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh: Flags [.], ack 517984, win 252, length 0 18:56:08.429723 IP c-67-164-182-219.hsd1.co.comcast.net.50171 > linuxsource.ssh: Flags [P.], seq 3681:3745, ack 515568, win 255, length 64 ^C18:56:08.429925 IP linuxsource.ssh > c-67-164-182-219.hsd1.co.comcast.net.50171: Flags [P.], seq 530368:530960, ack 3745, win 172, length 592 2781 packets captured 2781 packets received by filter 0 packets dropped by kernel
  • 67. Trace Utilities ā€¢ Different utilities on different platforms, but for Linux: ā€¢ strace ā€¢ Attach to or run a process and then trace: ā€¢ UNIX system calls executed ā€¢ Signals received ā€¢ Machine faults incurred ā€¢ (optional) entry/exit trace of user level function calls
  • 68. What is DTRACE? ā€¢ Performance analysis and troubleshooting tool (http://dtrace.org ) ā€¢ Not just user-level software (i.e. applications, databases and webservers) ā€¢ also OS kernel and device drivers ā€¢ provides a language, (i.e. ā€œDā€) for writing DTrace scripts and one-liners ā€¢ Terrific case-study of I/O performance analysis using DTrace ā€¢ https://blogs.oracle.com/BestPerf/entry/i_o_analysis_using_dtrace ā€¢ Installation: $apt-get install systemtap-sdt-dev 68
  • 69. dtrace Utility $ dtrace -n 'proc:::exec-success{printf("%d %sā€,timestamp,curpsinfo- >pr_psargs);}ā€™ dtrace: description 'proc:::exec-success ' matched 1 probe CPU ID FUNCTION:NAME 1 797 exec_common:exec-success 21935388676181394 man ls 0 797 exec_common:exec-success 21935388840101743 sh -c cd /usr/share/man; tbl /usr/sha 1 797 exec_common:exec-success 21935388858652639 col ā€“x 0 797 exec_common:exec-success 21935388863714971 neqn /usr/share/lib/pub/eqnchar ā€“ 0 797 exec_common:exec-success 21935388867119787 tbl /usr/share/man/man1/ls.1 1 797 exec_common:exec-success 21935388881310626 nroff -u0 -Tlp -man ā€“
  • 70. file Utility ā€œFinding Javaā€ $ file /usr/bin/java /usr/bin/java: symbolic link to `/etc/alternatives/javaā€™ $ file /etc/alternatives/java /etc/alternatives/java: symbolic link to `/usr/java/jdk1.7.0_51/jre/bin/javaā€™ $ file /usr/java/jdk1.7.0_51/jre/bin/java /usr/java/jdk1.7.0_51/jre/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped $ file make_logs.sql make_logs.sql: ASCII C program text
  • 71. What is FINDMNT? ā€¢ A [somewhat] directory tree view of Linux ā€¢ To Install: $ yum install findmnt ā€“y $ apt-get install findmnt 71
  • 74. What is NCDU? ā€¢ Quick utility to gather info on space usage in a directory ā€¢ To install: $ yum install ncdu ā€“y $ apt-get install ncdu Simply execute ncdu command in directory that you wish to gather detailed file/directory sizes on 74
  • 76. Linux for the DBA Summary ā€¢ Learn to walk before you run ā€¢ Command line is essential ā€¢ Utilities are your friends ā€¢ A few will get you far, choose which ones provide you with what you need. ā€¢ Build a knowledge of command line editing tools, such as VIM or Nano and Shell scripting to enhance utilities for full coverage. ā€¢ Tough at first, but will become second nature- I promise! 76