Tuesday, August 21, 2012

Alternative of "ls" command


It might happen that you will not be able to access "ls" command. It might not even be accessible from miniroot.

Using echo displays a clean list of files within a given directory.

e.g.
Hard system crashes or drives dying can bring systems down to the point where filesystems are so corrupted that they are unable to mount. When this occurs, at times the only way to see the system files is to use echo for displaying the files and directories.


#cd /usr

#ls *
bin  etc  games  include  java  kerberos  lib  libexec  local  man  nsh  openv
X11R6

- An output of ls can be a single or multiple column listing

#echo *
bin etc games include libexec local man nsh openv sbin share src tmp X11R6

- When echo is used, the files will all be spaced one right after the other.

Thursday, August 16, 2012

cPanel - mysqltuner script

At times, situation comes where we need to tune mysql on cPanel server's. cPanel server has built in script now a days named - mysqltuner.pl

Location - /usr/local/cpanel/3rdparty/mysqltuner/mysqltuner.pl

We can make use of it in need onto the server.

e.g.

root@[/usr/local/cpanel/3rdparty/mysqltuner]# ./mysqltuner.pl
 >> MySQLTuner 1.1.2 - Major Hayden <major@mhtx.net>
 >> Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >> Run with '--help' for additional options and output filtering
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.63-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2G (Tables: 23107)
[--] Data in InnoDB tables: 598M (Tables: 5883)
[--] Data in MEMORY tables: 0B (Tables: 205)
[!!] Total fragmented tables: 6835
-------- Performance Metrics -------------------------------------------------
[--] Up for: 44m 31s (95K q [35.748 qps], 2K conn, TX: 263M, RX: 15M)
[--] Reads / Writes: 81% / 19%
[--] Total buffers: 442.0M global + 12.4M per thread (500 max threads)
[OK] Maximum possible memory usage: 6.5G (80% of installed RAM)
[OK] Slow queries: 0% (134/95K)
[OK] Highest usage of available connections: 2% (11/500)
[OK] Key buffer size / total MyISAM indexes: 384.0M/1.7G
[OK] Key buffer hit rate: 99.8% (9M cached / 19K reads)
[OK] Query cache efficiency: 73.0% (53K cached / 73K selects)
[!!] Query cache prunes per day: 21284
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts)
[!!] Joins performed without indexes: 372
[!!] Temporary tables created on disk: 29% (2K on disk / 10K total)
[OK] Thread cache hit rate: 99% (11 created / 2K connections)
[!!] Table cache hit rate: 12% (512 open / 4K opened)
[OK] Open file limit used: 21% (876/4K)
[OK] Table locks acquired immediately: 99% (33K immediate / 33K locks)
[!!] InnoDB data size / buffer pool: 598.5M/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
 Run OPTIMIZE TABLE to defragment tables for better performance
 MySQL started within last 24 hours - recommendations may be inaccurate
 Adjust your join queries to always utilize indexes
 When making adjustments, make tmp_table_size/max_heap_table_size equal
 Reduce your SELECT DISTINCT queries without LIMIT clauses
 Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
 query_cache_size (> 32M)
 join_buffer_size (> 128.0K, or always use indexes with joins)
 tmp_table_size (> 16M)
 max_heap_table_size (> 16M)
 table_cache (> 512)
 innodb_buffer_pool_size (>= 598M)
root@ [/usr/local/cpanel/3rdparty/mysqltuner]#

Tuesday, July 31, 2012

dmidecode: DMI type numbers

Dmidecode reports information about your system's hardware as described in your system BIOS according to the SMBIOS/DMI standard (see a sample output). 


This information typically includes system manufacturer, model name, serial number, BIOS version, asset tag as well as a lot of other details of varying level of interest and reliability depending on the manufacturer. This will often include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB).


The DMI type numbers, shown below, used individually or in a comma separated list provide you with targeted information.



Type Information
—————————————-
0 BIOS
1 System
2 Base Board
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply


Usage:


e.g.
#dmidecode -t 1
#dmidecode -t 1,19