Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Saturday, November 8, 2008

HOWTO: Log Boot Messages

HOWTO: Log Boot Messages

At times I find it very difficult to see what has successfully loaded or not during boot up. There is a way to initiate logging during startup (boot).

Here's how to set it up:

You need to enable boot logging by opening a terminal and typing the following:
Code:
$ sudo gedit /etc/default/bootlogd
The text editor will open, and the following will be show:

Code:
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=No
Change BOOTLOGD_ENABLE to yes

Now, everytime you restart, /var/log/boot will be created, and it will contain a log of all your boot messages. You need to be root to open it, so you can easily open it up again with sudo.


Quote:
NOTE: On my machine, I get a message on my screen during boot saying that the boot log has failed. But it was lying, the boot log worked just fine.

ALSO NOTE: The boot log will be full of lines like this '^[[A^[[74G[ ok ]'. All that 'garbage' is just the color code used to display the text as white or red during boot. It seems to get captured along with all the rest of the text.
So there you have it! This is a really useful feature, and I was slightly surprised that this was disabled by default.

Wednesday, October 29, 2008

Create a Tar File of current Directory and Sub Directories


Create a tar file of current directory and all sub directories:


Just give the name of the directory to tar. For example, suppose you want to create a tar file for all the files (including all subdirectories) in the directory called myfiles. Give this command from the directory that contains myfiles:
Code:
tar cvf myfiles.tar myfiles

The find command is used to create a list of all the file names that end in .tex. The --files-from argument to tar is then used; this tells tar to only archive those files listed in /tmp/texfilenames.


To check the list of files in the tar file, you can use the t option. For example,

Code:
tar tf myfiles.tar | less 


Search for files and archive only select ones from a list in a file:


Code:
find myfiles -name "*.tex" > /tmp/texfilenames
tar cvf myfiles.tar --files-from /tmp/texfilenames

Sunday, October 12, 2008

Useful Ubuntu commands

Here are some of useful commands that I have come across:

List installed packages / Easy Restore



Create a list of installed packages:

Code:
dpkg --get-selections > installed-software
And if you wanted to use the list to reinstall this software on a fresh ubuntu setup,

Code:
dpkg --set-selections <> 
followed by

Code:
dselect