Linux Blog

Linux History Command

Filed under: General Linux,Linux Software — TheLinuxBlog.com at 5:00 am on Wednesday, November 17, 2010

linux find command

History is great. How does the saying go?

“Those who forget about history are doomed to repeat it?”

If that’s the saying I think it is more fitting to say that for those who forget the Linux History Command are doomed to repeat typing. A lot. Seriously, the history command can help you remember the exact Linux find command with the intricate search options you typed a while ago. It could help you open up your x2x or x2vnc sessions after a reboot. Who knows what you’ll use it for. All this comes at a little cost, you’ll have to know how to use it.

(Read on …)

Making Environment Variables Stick

Filed under: General Linux — TheLinuxBlog.com at 5:00 am on Sunday, October 3, 2010

So, setting environment variables is a pretty easy task right? I thought so too but recently I was unable to read a variable I set from within a Tomcat application no matter what I tried. The problem turns out was easy to fix.

All I needed was to set an environment variable, I didn’t care who had access to it since it was just a path but whatever I did, it just wouldn’t stick. I quickly found out from a co-worker about a magical command that would have been a solution. Problem now was he couldn’t remember what it was. Well it turns out that it is a bash built in called source. Using this with the /etc/profile file as follows: “source /etc/profile” fixed the problem without a reboot.

BackTrack Persistent “Press Enter Fix”

Filed under: General Linux,Shell Script Sundays — TheLinuxBlog.com at 5:37 pm on Sunday, November 1, 2009

One of the things that has irritated me about the persistent USB thumb drive installs is the “Press Enter” to continue prompt on shutdown. Luckily, if you have persistent working correctly, the fix for this is easy.

Open up /etc/rc0.d/S89casper
Search for ENTER and the shutdown string “Please remove the disc and close the tray (if any) then press ENTER: ” > /dev/console”
For me, this was on line 89. Comment out, that line and the lines down to the ending bracket for the do_stop() routine.

Reboot, and see if you have that annoying message, if not you’re good to go.

Fedora 11 Upgrade from Alpha to Beta

Filed under: General Linux — TheLinuxBlog.com at 10:56 am on Wednesday, April 1, 2009

After my mistake downloading the Alpha, I was able to update to the Beta by doing some pretty basic stuff.

First to aid I set up sudo, and changed my default run level to 3. I installed bash-completion (a mandatory package) and then changed to run level 3 with telinit. Once down to a reasonable run level for a systems upgrade, yum update -y was issued. I believe this failed, so I read the release notes and did the yum –skip-broken update command. It was rather scary since the broken libraries were glibc’s and those can be a pain. After a hour or more I was back to the prompt. Another yum update -y just to make sure and I was ready to reboot.

Rebooting actually worked first time and my Fedora was updated from 10.91 to 10.92. Using this method does not give you ext4 but, at least it will upgrade you to the latest Beta. Now, if only my production installation upgrades would have gone this smoothly.

Run Levels in a Nutshell

Filed under: Quick Linux Tutorials — TheLinuxBlog.com at 9:03 am on Wednesday, March 11, 2009

Run levels in Linux are a great thing. Basically, a run level is by definition a configuration for a group of processes. The run levels and default run level is specified in /etc/inittab. Most Linux systems these days, with exception of a few boot into run level 5 which is generally a graphical user interface such as KDM or GDM. The others boot into run level 3 most servers will boot into this run level which is multi-user with networking but no X, and is many users preference.

To define what run level your system boots into by default you would edit the /etc/inittab file and edit the line similar to:

 id:5:initdefault:

This is run level 5, if you wanted to switch to command line you’d change the 5 to 3 and vice versa.

If your not ready to make the jump yet but would like to check it out, you can (as root) use the command telinit to tell init to change run level. If you are in run level 5, try (be prepared to lose everything in X, as it will kill everything for you)

 telinit 3

If you are doing maintenance, you may want to switch to level 1 which is single user mode. Level 2 on Fedora is the same as 3 except it doesn’t have NFS support.

Level 0 is halt and run level 6 is reboot which are the best ones to accidentally set as a default run level (trust me on this one.) For more information on the different run levels check out the man pages.

Fix For Grub Problem After Fedora Update

Filed under: General Linux — TheLinuxBlog.com at 10:06 am on Tuesday, February 24, 2009

After updating a Fedora installation a development server froze sitting there with GRUB on the screen at boot.
It had been like this all night after a successful upgrade earlier that day. yum update was run from a screen session and then connected to from home. What had caused the problem was the kernel and possibly grub had been updated. This caused the system to need a reboot, but after the reboot the drive map had changed.

Fortunately when I came in the next morning I had an e-mail with a link to this website: http://readlist.com/lists/redhat.com/fedora-list/51/259917.html with a solution to the problem.

Here are the step by step instructions since they are not clearly lined out on the site:

1) Insert Fedora installation media
2) boot to rescue mode
3) choose language, skip network settings
4) once you are at a shell, type:
5) grub –device-map=/tmp/drivemap
6) quit
7) vi,pico or nano /tmp/drivemap and move sda and sdb around, or perhaps hda.
8) chroot /mnt/sysimage
9) I had checked that /tmp/drivemap had stayed the same by running cat /tmp/drivemap
10) grub –device-map=/tmp/drivemap
11) quit
12) grub-install
13) reboot

After grub gave its usual message I rebooted, removed the CD and everything worked as expected. Excellent. I’ve always used lilo over grub, but recently the distributions I’ve been using use grub and more importantly the servers I manage. Therefore I guess I better get more accustomed to grub. Luckily the server this went wrong on was a development server and nothing mission critical, so thankfully no one had to make the long haul into the data center to fix this issue at 1:00am. Hopefully you will be just as lucky if you run into this issue.

General Linux Change Password

Filed under: General Linux,Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 4:52 am on Thursday, December 20, 2007

Changing your password under Linux is a pretty simple task providing you know how to do it, and of course since we’re talking about Linux: changing your password is as simple or complicated as you want it to be either way. You either love GUI’s or you hate them, so one method or the other can be confusing. I’m more of a console guy, but I’ll start with the GUI methods because thats probably what I think the masses want to see first. Remember what your doing tho, if you need to change the password on more than one box, I would look into changing your password by command line.

There is more than one reason to change your password, the examples below assume that you are just changing the current users password because it needs to be changed.

kdepasswd

kdepasswd example

passwd

linux change passwd

If you need to change the password for another user, log in as root and execute the following:

passwd (username)

linux change passwd

There are many ways to change your root password if you forgot it.

One way to do it is to boot up with a live CD, mount your hard drive, chroot and then execute the passwd command, once you reboot your password should be reset.