diff options
Diffstat (limited to 'content/blog/commands')
-rw-r--r-- | content/blog/commands/asterisk-call-you.md | 4 | ||||
-rw-r--r-- | content/blog/commands/asterisk-list-active-calls.md | 4 | ||||
-rw-r--r-- | content/blog/commands/busybox-web-server.md | 4 | ||||
-rw-r--r-- | content/blog/commands/capture-desktop-video.md | 4 | ||||
-rw-r--r-- | content/blog/commands/clean-conntrack-states.md | 4 | ||||
-rw-r--r-- | content/blog/commands/date.md | 4 | ||||
-rw-r--r-- | content/blog/commands/find-hardlinks.md | 4 | ||||
-rw-r--r-- | content/blog/commands/find-inodes-used.md | 4 | ||||
-rw-r--r-- | content/blog/commands/git-import-commits.md | 4 | ||||
-rw-r--r-- | content/blog/commands/git-rewrite-commit-history.md | 4 | ||||
-rw-r--r-- | content/blog/commands/ipmi.md | 4 | ||||
-rw-r--r-- | content/blog/commands/mdadm.md | 20 | ||||
-rw-r--r-- | content/blog/commands/omreport.md | 4 | ||||
-rw-r--r-- | content/blog/commands/qemu-nbd.md | 4 | ||||
-rw-r--r-- | content/blog/commands/qemu.md | 8 | ||||
-rw-r--r-- | content/blog/commands/rrdtool.md | 4 |
16 files changed, 42 insertions, 42 deletions
diff --git a/content/blog/commands/asterisk-call-you.md b/content/blog/commands/asterisk-call-you.md index 75d642b..ce62556 100644 --- a/content/blog/commands/asterisk-call-you.md +++ b/content/blog/commands/asterisk-call-you.md @@ -8,6 +8,6 @@ tags: ## Using the cli -{{< highlight yaml >}} +```sh watch -d -n1 'asterisk -rx “core show channels”' -{{< /highlight >}} +``` diff --git a/content/blog/commands/asterisk-list-active-calls.md b/content/blog/commands/asterisk-list-active-calls.md index 285d330..e9723e7 100644 --- a/content/blog/commands/asterisk-list-active-calls.md +++ b/content/blog/commands/asterisk-list-active-calls.md @@ -11,6 +11,6 @@ tags: At alterway we sometimes have DTMF problems that prevent my mobile from joining a conference room. Here is something I use to have asterisk call me and place me inside the room : -{{< highlight yaml >}} +``` channel originate SIP/numlog/06XXXXXXXX application MeetMe 85224,M,secret -{{< /highlight >}} +``` diff --git a/content/blog/commands/busybox-web-server.md b/content/blog/commands/busybox-web-server.md index 60cc1be..14470fa 100644 --- a/content/blog/commands/busybox-web-server.md +++ b/content/blog/commands/busybox-web-server.md @@ -11,6 +11,6 @@ tags: If you have been using things like `python -m SimpleHTTPServer` to serve static files in a pinch, here is something even more simple and lightweight to use : -{{< highlight sh >}} +```sh busybox httpd -vfp 80 -{{< /highlight >}} +``` diff --git a/content/blog/commands/capture-desktop-video.md b/content/blog/commands/capture-desktop-video.md index 3bc0c38..8318c48 100644 --- a/content/blog/commands/capture-desktop-video.md +++ b/content/blog/commands/capture-desktop-video.md @@ -10,6 +10,6 @@ tags: You can capture a video of your linux desktop very easily with ffmpeg : -{{< highlight sh >}} +```sh ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq /tmp/out.mpg -{{< /highlight >}} +``` diff --git a/content/blog/commands/clean-conntrack-states.md b/content/blog/commands/clean-conntrack-states.md index eee4da9..3621dfe 100644 --- a/content/blog/commands/clean-conntrack-states.md +++ b/content/blog/commands/clean-conntrack-states.md @@ -10,10 +10,10 @@ tags: Firewalling on linux is messy, here is an example of how to clean conntrack states that match a specific query on a linux firewall : -{{< highlight sh >}} +```sh conntrack -L conntrack -p tcp –orig-dport 65372 | \ while read _ _ _ _ src dst sport dport _; do conntrack -D conntrack –proto tcp –orig-src ${src#*=} –orig-dst ${dst#*=} \ –sport ${sport#*=} –dport ${dport#*=} done -{{< /highlight >}} +``` diff --git a/content/blog/commands/date.md b/content/blog/commands/date.md index 1472940..9612124 100644 --- a/content/blog/commands/date.md +++ b/content/blog/commands/date.md @@ -10,7 +10,7 @@ tags: I somehow have a hard time remembering this simple date flags *(probably because I rarely get to practice it), I decided to write it down here : -{{< highlight sh >}} +```sh $ date -d @1294319676 Thu Jan 6 13:14:36 GMT 2011 -{{< /highlight >}} +``` diff --git a/content/blog/commands/find-hardlinks.md b/content/blog/commands/find-hardlinks.md index d418cc3..e8ebbea 100644 --- a/content/blog/commands/find-hardlinks.md +++ b/content/blog/commands/find-hardlinks.md @@ -10,6 +10,6 @@ tags: ## The command -{{< highlight sh >}} +```sh find . -samefile /path/to/file -{{< /highlight >}} +``` diff --git a/content/blog/commands/find-inodes-used.md b/content/blog/commands/find-inodes-used.md index 4936c70..4efad9d 100644 --- a/content/blog/commands/find-inodes-used.md +++ b/content/blog/commands/find-inodes-used.md @@ -10,6 +10,6 @@ tags: ## The command -{{< highlight sh >}} +```sh find . -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n -{{< /highlight >}} +``` diff --git a/content/blog/commands/git-import-commits.md b/content/blog/commands/git-import-commits.md index 0286282..bb92b26 100644 --- a/content/blog/commands/git-import-commits.md +++ b/content/blog/commands/git-import-commits.md @@ -9,6 +9,6 @@ tags: ## The trick In an ideal world there should never be a need to do this, but here is how to do it properly if you ever walk into this bizarre problem. This command imports commits from a repo in the `../masterfiles` folder and applies them to the repository inside the current folder : -{{< highlight sh >}} +```sh (cd ../masterfiles/; git format-patch –stdout origin/master) | git am -{{< /highlight >}} +``` diff --git a/content/blog/commands/git-rewrite-commit-history.md b/content/blog/commands/git-rewrite-commit-history.md index 8378a9c..4176c82 100644 --- a/content/blog/commands/git-rewrite-commit-history.md +++ b/content/blog/commands/git-rewrite-commit-history.md @@ -9,6 +9,6 @@ tags: ## git filter-branch Here is how to rewrite a git commit history, for example to remove a file : -{{< highlight sh >}} +```sh git filter-branch –index-filter "git rm --cached --ignore-unmatch ${file}" --prune-empty --tag-name-filter cat - -all -{{< /highlight >}} +``` diff --git a/content/blog/commands/ipmi.md b/content/blog/commands/ipmi.md index 4e00be1..a45879d 100644 --- a/content/blog/commands/ipmi.md +++ b/content/blog/commands/ipmi.md @@ -11,9 +11,9 @@ tags: - launch ipmi remote text console : `ipmitool -H XX.XX.XX.XX -C3 -I lanplus -U <ipmi_user> sol activate` - Show local ipmi lan configuration : `ipmitool lan print` - Update local ipmi lan configuration : -{{< highlight sh >}} +```sh ipmitool lan set 1 ipsrc static ipmitool lan set 1 ipaddr 10.31.149.39 ipmitool lan set 1 netmask 255.255.255.0 mc reset cold -{{< /highlight >}} +``` diff --git a/content/blog/commands/mdadm.md b/content/blog/commands/mdadm.md index da15041..a2825f5 100644 --- a/content/blog/commands/mdadm.md +++ b/content/blog/commands/mdadm.md @@ -9,34 +9,34 @@ tags: ## Watch the array status -{{< highlight sh >}} +```sh watch -d -n10 mdadm --detail /dev/md127 -{{< /highlight >}} +``` ## Recovery from livecd -{{< highlight sh >}} +```sh mdadm --examine --scan >> /etc/mdadm.conf mdadm --assemble --scan /dev/md/root mount /dev/md127 /mnt # or vgscan... -{{< /highlight >}} +``` If auto detection does not work, you can still assemble an array manually : -{{< highlight sh >}} +```sh mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 -{{< /highlight >}} +``` ## Resync an array First rigorously check the output of `cat /proc/mdstat` -{{< highlight sh >}} +```sh mdadm --manage --re-add /dev/md0 /dev/sdb1 -{{< /highlight >}} +``` ## Destroy an array -{{< highlight sh >}} +```sh mdadm --stop /dev/md0 mdadm --zero-superblock /dev/sda mdadm --zero-superblock /dev/sdb -{{< /highlight >}} +``` diff --git a/content/blog/commands/omreport.md b/content/blog/commands/omreport.md index a5d90e5..de46c8a 100644 --- a/content/blog/commands/omreport.md +++ b/content/blog/commands/omreport.md @@ -12,8 +12,8 @@ tags: ## Other commands -{{< highlight sh >}} +```sh omreport storage vdisk omreport storage pdisk controller=0 vdisk=0 omreport storage pdisk controller=0 pdisk=0:0:4 -{{< /highlight >}} +``` diff --git a/content/blog/commands/qemu-nbd.md b/content/blog/commands/qemu-nbd.md index 0402876..a9a5ceb 100644 --- a/content/blog/commands/qemu-nbd.md +++ b/content/blog/commands/qemu-nbd.md @@ -9,11 +9,11 @@ tags: ## Usage example -{{< highlight sh >}} +```sh modprobe nbd max_part=8 qemu-nbd -c /dev/nbd0 image.img mount /dev/nbd0p1 /mnt # or vgscan && vgchange -ay [...] umount /mnt qemu-nbd -d /dev/nbd0 -{{< /highlight >}} +``` diff --git a/content/blog/commands/qemu.md b/content/blog/commands/qemu.md index 294c9a9..b4301a8 100644 --- a/content/blog/commands/qemu.md +++ b/content/blog/commands/qemu.md @@ -10,23 +10,23 @@ tags: ## Quickly launch a qemu vm with local qcow as hard drive In this example I am using the docker0 bridge because I do not want to have to modify my shorewall config, but any proper bridge would do : -{{< highlight sh >}} +```sh ip tuntap add tap0 mode tap brctl addif docker0 tap0 qemu-img create -f qcow2 obsd.qcow2 10G qemu-system-x86_64 -curses -drive file=install65.fs,format=raw -drive file=obsd.qcow2 \ -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0 qemu-system-x86_64 -curses -drive file=obsd.qcow2 -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0 -{{< /highlight >}} +``` The first qemu command runs the installer, the second one just runs the vm. ## Launch a qemu vm with your local hard drive My use case for this is to install openbsd on a server from a hosting provider that doesn't provide an openbsd installer : -{{< highlight sh >}} +```sh qemu-system-x86_64 -curses -drive file=miniroot65.fs -drive file=/dev/sda -net nic -net user -{{< /highlight >}} +``` ## Ressources diff --git a/content/blog/commands/rrdtool.md b/content/blog/commands/rrdtool.md index bca039a..dfeb6ca 100644 --- a/content/blog/commands/rrdtool.md +++ b/content/blog/commands/rrdtool.md @@ -8,13 +8,13 @@ tags: ## Graph manually -{{< highlight sh >}} +```sh for i in `ls`; do rrdtool graph $i.png -w 1024 -h 768 -a PNG --slope-mode --font DEFAULT:7: \ --start -3days --end now DEF:in=$i:netin:MAX DEF:out=$i:netout:MAX \ LINE1:in#0000FF:"in" LINE1:out#00FF00:"out" done -{{< /highlight >}} +``` ## References |