This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MOUNTING A HARD DISK IMAGE INCLUDING PARTITIONS USING LINUX | |
| JANUARY 22, 2008 ANDRE 63 COMMENTS | |
| A while ago I thought it would be a good idea to make a backup of my Linux server by just dumping the complete disk to a file. In retrospect, it would have been much easier had I just dumped the individual filesystems. | |
| When I finally got around to using this backup, long after the 10GB disk had perished I realized that to use the loopback device to mount a filesystem it actually needs a filesystem to mount. What I had was a disk image, including partition table and individual partitions. To further complicate matters the data partition was also not the first partition inside this image. | |
| For reference, I created this image using the Unix ‘dd’ tool: | |
| # dd if=/dev/hda of=hda.img | |
| 30544113+0 records in | |
| 30544113+0 records out | |
| # ls -lh | |
| -rw-r--r-- 1 root root 9.6G 2008-01-22 14:12 hda.img |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| checkInternet() | |
| { | |
| echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 # query google with a get request | |
| if [ $? -eq 0 ]; then #check if the output is 0, if so no errors have occured and we have connected to google successfully | |
| return 0 | |
| else | |
| echo "Error: no active internet connection" >&2 #sent to stderr | |
| return 1 | |
| fi | |
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # filters the screen -ls output to show the sesssions | |
| sessions=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\|(Multi, detached)\|(Multi, attached)\)// p'` | |
| #echo $sessions | |
| #echo $sessions | wc -w | |
| res=`echo "$sessions" | wc -w` | |
| if [[ "$res" != "0" ]] | |
| then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [user] | |
| name = John Safrit | |
| email = jsafrit@users.noreply.github.com | |
| [alias] | |
| co = checkout | |
| ci = commit | |
| st = status | |
| br = branch | |
| hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
| type = cat-file -t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # some more ls aliases | |
| alias ll='ls -alF' | |
| alias more='less' | |
| alias la='ls -A' | |
| alias l='ls -CF' | |
| alias h="history" | |
| alias gno="gnome-open" | |
| alias pu="pushd" | |
| alias po="popd" |