Search This Blog

Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Wednesday, June 19, 2013

F5 Network BigIp cheat sheet

This post is a work in progress...
  • How to generate a list with one self ip and vlans per line 
# tmsh list /net self  | egrep 'self|vlan' | xargs -n 6 echo
net self 10.2.2.2/30 { vlan FAILOVER
net self 10.176.30.100/19 { vlan hybridServiceNet-140
net self 10.176.30.102/19 { vlan hybridServiceNet-140
net self 10.176.94.132/19 { vlan hybridServiceNet-142

Or 


# tmsh list net self | egrep -v 'floating|unit|allow-service' | xargs -n 7
net self 10.178.191.49/18 { vlan rackconnect110 }
net self 10.179.63.181/18 { vlan rackconnect112 }


  • How to simulate F5 health check requests with empty Host header
  • How to parse tmsh output
http://rtomaszewski.blogspot.co.uk/2013/07/ways-to-parse-tmsh-output-and-automate.html

Friday, April 5, 2013

Powershell tutorial for Linux users

Powershell vs bash Linux commands
Description Linux Bash Powershell
list all available commands Tab Tab gcm
multiple commands with a name foo type -a foo gcm foo
print PATH variable  echo $PATH  echo $env:path
print PATH variable  echo $PATH  echo $env:path
set or export a variable export VARIABLE="foo" $env:VARIABLE="foo"
bash navigation shortcuts - Tab
- history
- Control+U
-Control+K
-Alt+B/Control left
-Alt+F/Control right
- Control+R

- [Tab] Autocomplete folder/file name.
- F7 Show history of previous commands
- F9 Run a specific command from the command history.
- Ctrl Home Erase line to the left.
- Ctrl End  Erase line to the right.
- Ctrl arrow left Move one word to the left (backward)
- Ctrl arrow right Move one word to the right (forward)
- F8 Move backwards through the command history, but only display
commands matching the current text at the command prompt.

References
  1. http://technet.microsoft.com/en-us/library/hh849711.aspx
  2. http://ss64.com/nt/syntax-keyboard.html
  3. http://technet.microsoft.com/en-us/library/ff730964.aspx

Saturday, November 7, 2009

Linux trick with grep tool

Command line tools are like grep are very useful when working a lot with text files.

One unknown feature is the --color options which shows you in different colour the matching string grep found.

user@host:~$ egrep '(vmx|svm)' --color=always /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm ida tpr_shadow vnmi flexpriority

Wednesday, November 4, 2009

Small trick with a 'stat' tool in Linux

I used many times 'stat' tool to find out information about a physical file. Normally the output looks like that:

user@host:/tmp$ stat myfile.txt
File: `myfile.txt'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 325124 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/radoslaw) Gid: ( 1000/radoslaw)
Access: 2009-11-04 16:15:07.000000000 +0100
Modify: 2009-11-04 16:15:07.000000000 +0100
Change: 2009-11-04 16:15:07.000000000 +0100

There is another very useful options, -f, that shows different information.

user@host:/tmp$ stat -f myfile.txt
File: "myfile.txt"
ID: a0fb1614334b9c81 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 2460827 Free: 647809 Available: 522804
Inodes: Total: 625856 Free: 407715

In the output you can find a lot of file system related information, like the block size or file system name.

And When you want to find only the file system name you can run:

user@host:/tmp$ stat -f -c "%T" myfile.txt
ext2/ext3

Linux, date tool trick

How many times did you have to get same date and do something with it. To calculate this dates is very annoying, unless you know a few tricks with date command :).

How to find quickly some dates:

$ date -d yesterday
$ date -d '2 days ago'
$ date -d '1 week ago'
$ date -d tomorrow
$ date -d '2 days'
$ date -d '1 week'

For example, when did you born:

$ date
Di 12 Aug 11:44:57 CEST 2008
$ date -d "11 days ago 7 month ago 28 years ago"
Di 1 Jan 10:43:49 CET 1980

Linux, find tool trick

Many times when you are working with some application which create some lock/log/shared/record files you want to know what is happening for a sort time ago for example. The quick trick with the find tool allow you to find for example all files which ware created/changed for _xyz_ minutes ago.

How to find quickly new created files in some directory:

$ find /tmp/ -cmin -1 -maxdepth 1
$ find /tmp/ -cmin -10 -maxdepth 1

Potential problems with "Write Back Caching"

For the modern hd drives there is something what can make some problems when the operating system crushed. It is also got to know for troubleshooting and tuning of os and application like data base for example.

Try it for your self:

# man hdparm
# man sdparm

To disable write cache execute:
#hdparm -W0 /dev/hdX | device
#sdparm --set WCE=0

To enable write cache execute:
#hdparm -W1 device
#sdparm --set WCE=1

# sdparm -a -e /dev/sda
# sdparm --page=ca --long /dev/sda
/dev/sda: ATA Hitachi HTS72201 DCDO
Direct access device specific parameters: WP=0 DPOFUA=0
Caching (SBC) [ca] mode page:
IC 0 Initiator control
ABPF 0 Abort pre-fetch
CAP 0 Caching analysis permitted
DISC 0 Discontinuity
SIZE 0 Size enable
WCE 1 Write cache enable
MF 0 Multiplication factor
RCD 0 Read cache disable
DRRP 0 Demand read retention priority
WRP 0 Write retention priority
DPTL 0 Disable pre-fetch transfer length
MIPF 0 Minimum pre-fetch
MAPF 0 Maximum pre-fetch
MAPFC 0 Maximum pre-fetch ceiling
FSW 0 Force sequential write
LBCSS 0 Logical block cache segment size
DRA 0 Disable read ahead
NV_DIS 0 Non-volatile cache disable
NCS 0 Number of cache segments
CSS 0 Cache segment size


a few links in net:
The sdparm utility
Praxis-Know-how: RAID-Controller optimal konfigurieren
MySql InnoDB Configuration
Experiments on Disk Write Back Caches in Linux
The Linux Page Cache and pdflush: Theory of Operation and Tuning for Write-Heavy Loads
Linux IDE Problem beim Write Back Caching
turning on dma and write back cache on SATA