Archive for the ‘Linux’ Category

Redirection of command output — a scrollable alternative to |more

July 30, 2009

I’m sure many Linux people already know this, but I discovered it today and figured I’d keep it on hand for when I need it again (that’s what this blog is for, after all).  I knew it was possible to redirect output to a file using >, redirect input from a file using < and chain the output of one command as the input of another using | but I didn’t know it was possible to redirect the output of a command (or series of commands) using <(...) too.

I’m used to doing things like ls -lrt | more to page the results of a directory listing, for example, but as a Windows user, I’m too used to being able to scroll my terminal (or command prompt) output to go back and forward and you just can’t do that in a pure terminal like I have been dealing with recently.

Enter the <(...) construct:

vi <(ls -lrt)

Now the output of ls -lrt is redirected to the vi editor as some kind of pseudo-file.  I can page up and down to my heart’s content.

I also discovered the du and comm utilities today (told you I was new) and using a combination of all of them can now compare the size of folders under two separate parents:

vi <(comm <(cd /dir1; du .) <(cd /dir2; du .))

This changes the current directory to /dir1, spools the size of all subfolders to a pseudo-file, changes the current directory to /dir2, spools the size of all subfolders to another pseudo-file, spools the comparison of the two pseudo-files to a third pseudo-file and shows that file in vi, for me to look around.

Perfect for eyeballing the results of a local rsync.  It took a whole batch file to do the same last time I tried in Windows.

Advertisements

Reinstating the GUI login page

September 20, 2007

Having just completed a 5-hour install process I, spent another two hours trying to fix up an issue I had with the login screen.

Having messed about with the options on the Login Screen, I inadvertently configured the X Server to try to login to a XDMCP server, by setting the startup server to Chooser.

When I rebooted, I couldn’t find any XDMCP servers, so I couldn’t login. I thought I’d try booting to a terminal mode, only to find that the kboot loader loaded Fedora if I left the keyboard idle for too long (about three seconds0).

Eventually I found out that I could get to a terminal from the XDMCP screen by pressing CTRL+ALT+F1. After that, I could log in as root and edit the GDM config file with VIM:
vi /etc/gdm/custom.conf
allowed me to edit the file, so I scrolled down to the [servers] section and changed the entry from:

[servers]
0=Chooser

to:

[servers]
0=Standard

After rebooting, the regular login screen was displayed.

I’ve learned two things from this:

  1. CTRL+ALT+F1 opens a terminal from the login screen
  2. I’m not going to mess with the startup screen again (I don’t even know what an XDMCP server is, let alone why I might want one!)