Below you will find pages that utilize the taxonomy term “Utility”
September 26, 2019
Unfinished Drafts: Useful Utility: tar
This is another article that sat in the drafts folder for far too long- Last edited Feb 21st, 2006.
I fear writing about tar, and that is why I’m determined to finish it in this sitting, so it won’t fester and scare me off of this series. Why am I scared of writing about tar? Well, this is their flags list verbatim from the man page:
[ --atime-preserve ] [ -b, --blocking-factor N ] [ -B, --read-full-records ] [ --backup BACKUP-TYPE ] [ --block-com- press ] [ -C, --directory DIR ] [ --check-links ] [ --checkpoint ] [ -f, --file [HOSTNAME:]F ] [ -F, --info-script F --new-volume-script F ] [ --force-local ] [ --format FORMAT ] [ -g, --listed-incremental F ] [ -G, --incremental ] [ --group GROUP ] [ -h, --dereference ] [ --help ] [ -i, --ignore-zeros ] [ --ignore-case ] [ --ignore-failed-read ] [ --index-file FILE ] [ -j, --bzip2 ] [ -k, --keep-old-files ] [ -K, --starting-file F ] [ --keep-newer-files ] [ -l, --one-file-system ] [ -L, --tape-length N ] [ -m, --touch, --modification-time ] [ -M, --multi-volume ] [ --mode PER- MISSIONS ] [ -N, --after-date DATE, --newer DATE ] [ --newer-mtime DATE ] [ --no-anchored ] [ --no-ignore-case ] [ --no-recursion ] [ --no-same-permissions ] [ --no-wildcards ] [ --no-wildcards-match-slash ] [ --null ] [ --numeric-owner ] [ -o, --old-archive, --portability, --no-same-owner ] [ -O, --to-stdout ] [ --occurrence NUM ] [ --overwrite ] [ --overwrite-dir ] [ --owner USER ] [ -p, --same-permissions, --preserve-permissions ] [ -P, --abso- lute-names ] [ --pax-option KEYWORD-LIST ] [ --posix ] [ --preserve ] [ -R, --block-number ] [ --record-size SIZE ] [ --recursion ] [ --recursive-unlink ] [ --remove-files ] [ --rmt-command CMD ] [ --rsh-command CMD ] [ -s, --same- order, --preserve-order ] [ -S, --sparse ] [ --same-owner ] [ --show-defaults ] [ --show-omitted-dirs ] [ --strip-com- ponents NUMBER, --strip-path NUMBER (1) ] [ --suffix SUFFIX ] [ -T, --files-from F ] [ --totals ] [ -U, --unlink- first ] [ --use-compress-program PROG ] [ --utc ] [ -v, --verbose ] [ -V, --label NAME ] [ --version ] [ --volno-file F ] [ -w, --interactive, --confirmation ] [ -W, --verify ] [ --wildcards ] [ --wildcards-match-slash ] [ --exclude PATTERN ] [ -X, --exclude-from FILE ] [ -Z, --compress, --uncompress ] [ -z, --gzip, --gunzip, --ungzip ] [ -[0-7][lmh] ] So it’s a bit overwhelming.
read moreSeptember 26, 2019
Unfinished Drafts: Useful Utility: cat
This article was originally written back on Feb 21st, 2006. While never completed, I thought it was worth sharing.
Cat is a very simple utility- so simple I debated added it to this list. There are however three really useful flags. I’ll try to write as much as I can about it so you don’t feel ripped off by this article. hrm… did that last sentence sound like filler? I swear it wasn’t meant to- that’s completely on accident.
read moreApril 10, 2011
SOLVED: Halp, “screen” is broken on CentOS on my Linode instance!
So while migrating some content to a Linode instance, I attempted to fire up screen ran face first into a brick wall. For context, this was on an up-to-date CentOS 5.5 instance running screen-4.0.3-3.el5. Steps to reproduce:
logged in as my normal user typed in “screen” and hit enter console went blank for 5 seconds previous content returned, along with “[screen is terminating]” and my normal command prompt. Screen didn’t work for any regular users, however it did work for root.
read moreJune 25, 2010
Useful Utility: less
Less is more.
That’s the common joke about less- It provides the same functionality as the older utility, more; but oh, how much more than more!
Less allows you to easily scan backwards as well as forwards- something more is not too good at (though it is possible). Less also allows you to navigate with arrow keys, page up and page down, home and end.
Less provides a quick way to view files as well- Many editors (like vim) need to read an entire file first, and often create a temporary copy (for editing) of the file.
read moreNovember 20, 2007
Introduction to Subversion
I was planning on simply republishing my previous svn article, but realized that it sucked compared to what I know now.
Prerequisites I’ll presume you have the following things.
– a Linux machine
– subversion already installed
Terminology to Know There are a few terms that get mangled if you’re coming from other types of source control. This is just to clear things up.
– Repository: the central storage place on the subversion server where your data is kept.
read moreOctober 7, 2007
Intro to Vim Tip #5 (Recording)
Search and replace is a great feature in most text editors, but what happens when you want to do more? Vim has a solution- recording macros. Suppose you have the following output from some ancient program that needs to be tweaked:
<br></br>X1222 22323 2A22 3303 0000 3334esss test 123<br></br>X2222 22353 2A22 3303 0001 3334esss tacd 456<br></br>X3222 22383 2A22 3303 0010 3334esss fals 789<br></br>X4222 22393 2A22 3303 0011 3334esss true 012<br></br>
read moreJune 8, 2007
Giving Back
I’ve been using and promoting open source for about 7 years now- it started back in 2000 when I began writing php and playing with apache. In 2003 I made the full switch to Linux. Since then I’ve produced several small little projects and put them under the GPL in hopes that it would help someone else. I’ve also written many articles and how-tos for my site to help spread what I’ve learned.
read moreMarch 29, 2007
Useful Utility: diff
Diff is a handy little command used to compare two text files- useful if trying to determine what’s changed in different versions of files, used by subversion to show what files have been changed, and can even create patch files for updating sourcecode. So what are some of the more useful flags?
* -i lets us ignore any capitalization changes
* -b lets us ignore any spacing changes
* -B ignore blank lines
read moreMarch 24, 2007
Useful Utility: route
Route is one of these hate-inspiring, jaw droppingly obtuse programs that you always get the syntax wrong on. The purpose is simple enough- show and/or change the routing table. The most common uses are:
route – shows the current entries route add – adds a new entry route del – removes an entry route flush– removes all entries Checking out your Routes
The simplest use of route is to simply run route at the command line:
read moreMarch 19, 2007
ldapifying an ubuntu server
I recently wrote a nice little script in ruby for ldapifying new ubuntu servers- all the server needs is a ssh key set up for root, the rest is cake…
jmorg@util3:~/base_configs# ./ldapify -h Usage: ldapify --install hostname [$options] ldapify --check hostname ldapify --uninstall hostname --install hostname hostname to ldapify(foo.pub.local) --uninstall hostname removes ldapification from hostname -a, --access_group access_group access_group that has access to hostname --no_group_dn No access_group limitations- use with caution.
read moreNovember 21, 2006
Useful Utility: tee
I have two requirements for a program being on this list: the first one is it has to be a utility- something scriptable or usable on the command line. The second is it also needs to have multiple arcane flags that I can write about, or just be so unknown that it’ll bring it to the attention of people that have never heard of it. Tee falls into the “never heard of it” group.
read moreJuly 14, 2006
Intro to Vim Tip #4 (Pasting)
If you need to paste into vim from somewhere else, and your code has tabs or spaces in it, you’ll notice that vim may add extra tabs. see, vim doesn’t see it as a paste event, it sees it as “you typing really fast”- and one thing vim does will is auto-indent. The problem is when you paste, you don’t want auto-indentation because your code is already indented.
to temporarily turn off auto-indenting, try this from insert mode:
read moreJuly 10, 2006
Intro to Vim Tip #3 (Visual Mode)
Another well used mode is Visual Mode, which turns your cursor into a hilighter.
open a textfile with several lines of text ad move the cursor to the middle
switch from command mode to visual mode:
v You’ll notice as you move the cursor around, you highlight different sections from the point you started to the point you left. you can press [esc] to return to command mode.
hilight a few lines of text from command mode:
read moreJuly 10, 2006
Intro to Vim Tip #2 (deleting)
Deleting in vim can be done several ways- in insert mode, the delete key and backspace key perform as you’d expect them to, but what if you want more?
delete the character to the left of the cursor:
[esc]d[left arrow] delete the character to the right of the cursor:
[esc]d[right arrow] deleting the current line from insert mode:
[esc]dd deleting the current line and the one below from insert mode:
read moreJuly 10, 2006
Intro to Vim Tip #1
Vim is a great tool, but using is can be a pita in the beginning- hence, we go through the basics. There are several command modes, but we’ll only discuss a few at first: Command Mode and Insert Mode.
Command mode is used to perform actions like saving, searching, etc. Insert mode is used to insert and delete text. You’ll be switching between them a lot.
Open a file from the cli:
read moreJune 21, 2006
recursing vimrc
I use vim a lot. a *LOT*. One thing that really annoys me is page width. When I’m writing code, I like to have a width set to 78 characters. But in some instances, say when I’m working on a book, I like the width set to 90 characters since it’s easier to read. This got me thinking… if I had vim check the current directory for a config, I could have custom configs for different directories.
read moreMarch 29, 2006
Useful Utility: sed
Sed is a powerful utility for going regexes on the fly. Regular Expressions (regex) are beyond the scope of this artcle, but I’ll try to write one later. As I go, I’ll explain the regexes I use, but you really should learn about them because they’re handy as hell in many different utilities.
First up, we’ll use a simple example of a regular expression. Suppose for some reason, you want a list of the Input Device names used by Xorg, and plan on piping it into another script later on.
read moreMarch 14, 2006
Useful Utility: whereis
Whereis is an older utility- it’s functionality shows us of a time when a program not only had a man page, but also stored the source on the machine in question. That’s becoming more rare as programs like firefox come into play- firefox, for example, has no man page and doesn’t install the source (due to size issues).
Whereis locates the binary, man page and source of a given command on the current machine.
read moreMarch 9, 2006
Useful Utility: chown
Since I covered chmod last week, I figured I should touch upon chown this week. chown is infinitely less complex than chmod because you don’t have to worry about actual permissions. chown is mainly used by root, but I suppose it could be used by others as well, although it will happen much less often.
chown can change the owner and group of a file or files.
Standard usage goes something like this
read moreMarch 2, 2006
Useful Utility: chmod
Chmod is a utility used for changing permissions. It is fairly well known, and doesn’t have a lot of obscure flags, which makes it an odd choice for this series. I’m including it because it seems like the most logical way to touch on linux file permissions, which can be the bane of new linux user. Let me cover permissions first, then we’ll move on to chmod.
Simple Permissions (I’m only touching on “simple” permissions because they’re difficult enough to grasp without throwing in super user and stickey bits, or attributes like immutable.
read moreFebruary 27, 2006
Useful Utility: ls
With the exception of maybe cd (which is boring), ls is probably the command you’ll use the most if you do a fair amount of work at the command line.
ls lists files. It’s simple enough concept, but there’s a lot of information about those files that you can list as well. ls by itself will list the contents of all regular files and directories in the current directory. you can provide with with a target such as ls /foo or with multiple targets like ls /mnt /opt or ls foo.
read moreFebruary 23, 2006
Useful Utility: screen
Screen is probably one of the top 10 most useful programs in the unix world- why? Because of what it does. Screen lets you create a session on a machine and then disconnect, while the session stays open. Suppose you wanted to start a large compile on your home server before you left work, but needed to shut down your laptop and bring it home.
You could ssh into the machine and simply start the compiling, but the compilation would stop when you broke the ssh connection by shutting off the laptop.
read moreFebruary 21, 2006
Useful Utility: dig
No, not the popular social new site, the dns utility. Dig stands for Domain Information Groper (get it, DIG?), which fills the same niche as nslookup. As a matter of fact, dig is the successor to nslookup. Unlike nslookup however, the primary use of dig is non-interactive mode (which makes it ideal for scripting). Dig can also read batch files for more advanced executions, although I’ve not used this functionality myself.
read moreFebruary 21, 2006
Useful Utility: wget
Wget is useful for a lot of things- downloading images from a directory listing, mirroring a website, recursively fetching one subdirectory of a website, etc. The main focus as you can tell is downloading from the web(http, https, ftp) in a non-interactive manner.
There are a lot of flags to change the behavior, and you can get all sorts of wild behavior by mixing and matching those flags. The most straightforward use is this:
read moreFebruary 16, 2006
Useful Utility: cut
This is the first of a series of entries I’d like to do. Each week I’m gonna discuss a simple linux utility that you may or may not be familiar with.
First up is cut.
Cut can be used to shape data that is piped to it. for example, lets suppose you wanted a list of the real names and user names from the /etc/passwd file where you actually have a real name.
read more