bash cheat sheet - moving the cursor

if you are here, that means you already know some basic bash tricks.

like tab for auto-completion and the up and down keys to view previous commands in the bash history. i have collected from the internet some other key combinations

Moving the cursor:

multiuser screen aka sharing screen

screen is a screen manager. in years past if you had a long running job and it ws time for you to go home, you would start the job then throw it into the background and monitor the job via ps or log output or however you set up your job.

then came along screen

if you started a long running job at work and had to go home, you could resume your session and provide input to prompts if the job requested it. the other advantage of running a remote task or job in screen, is if your ISP suddenly decided to drop your connection, the job or task would continue uninterrupted

How To Upgrade From Fedora 20 To Fedora 21 (Desktop & Server)

Fedora 21 has changed things around a bit. there are now personalities; server, workstation, cloud. we got to take this into consideration when we do the upgrade
the first step is to update your installation

yum -y update

next, install the fedora upgrader

yum -y install fedup

and then checking the usage we get

Selling an all in one openstack cloud box on ebay

hello everyone

I am selling an all in one cloud box on ebay. the buy it now price is $1,499, but the bidding starts at $699 which means you could get it cheaper than the buy it now price

this is the link

how to watch streaming arabic tv

this how to is intended to get arabic channels set up on your tablet, pc, mac, apple tv. with it, you wont have to pay a monthly subscription to dish tv or whoever your subscription provider is

the number of available channels is quite large and it seems to have most if not all the channels available on nilesat and on arabsat. no promises though

how to install

installation is a 3 step process as outlined below

howto: make grub boot a specific stanza only once on the next boot for centos 6.x

sometimes when experimenting, we need a certain grub config/stanza. but what do we do if the stanza is not 100% there yet? well normally it means we have to reboot the box and manually select the healthy stanza and boot it.

however there are some scenarios that dont make this a reasonable approach. stanalone servers with no consoles attached.

so what we want is to tell grub to boot our new stanza only once and this is the command to do it

echo "savedefault --default=N --once" | grub --batch

where N is the number of the stanza you are working on.

howto: modify the partitions labels

disk labels are useful. the disk identifier used to be in the /dev/sdb format. but that device name is interchangeable with the other disks. so then it was best to use uuid but the uuid would depend on what the motherboard called its device. the above methods are not persistent. meaning it is not guaranteed across reboots and across different computers. so the best method is to use disk labels.

lets start off first with reading disk labels

how to add a swap file

lets assume, your server is setup in the cloud. and in the cloud RAM costs quite a bit. but the minimum configuration server provided has a lot of disk space. ssd disk space. an ssd disk is pretty fast. and you dont need all that ssd disk space for data. and you would like to use that fast disk space to expand your swap memory.

well read on!

learning from history

i always thought the history command wasnt configurable. boy was i wrong

so i was able to identify exactly when each command in history was run by using the command

export HISTTIMEFORMAT="%Y-%m-%d %T  "; history

where HISTTIMEFORMAT follows the date command's syntax.

more reading material can be found here

some file management commands

sometimes we need to know how to manage files from the command line. the usual cohort includes cp, rm and mv but what kind of extended commands are out there for us to use?

fdupes is a program that finds duplicate files and it is available in the epel repo

fdupes -R -d /path/to/dir1 /path/to/dir2

where -R tells it to search recursively and -d to delete (it asks you first which to keep)

cp -rn /path/1 /path/2

where -r is recursive, meaning copy directories and -n means no clobber, meaning do not overwrite


Subscribe to Posix In Egypt RSS