Finding the current runlevel of linux

To find the current runlevel of the system we can use the following commands

$ who -r run-level 2 2012-08-28 19:43 last= The output indicates that the current runlevel is “2” , followed by the date and the time. If there was any other runlevel used before it would be listed after “last=”. The second command that can be used is $ runlevel N 2 The second number is the current runlevel. The first number is the previous runlevel.

Category: Linux | Comments Off on Finding the current runlevel of linux

Finding the current runlevel of linux

To find the current runlevel of the system we can use the following commands

$ who -r run-level 2 2012-08-28 19:43 last= The output indicates that the current runlevel is “2” , followed by the date and the time. If there was any other runlevel used before it would be listed after “last=”. The second command that can be used is $ runlevel N 2 The second number is the current runlevel. The first number is the previous runlevel.

Category: Linux | Comments Off on Finding the current runlevel of linux

readlink: Finding file to which a softlink pointing to

readlink is a command that can be used on a softlink to find out the file to which it is actualy pointing to. For example if we have a file “temp” which is a softlink, we can run readlink of temp as follows

$ readlink temp test

This indicates that readlink is a softlink of the file temp. If we want the full path to the file “test” we can pass the option “-f”

$ readlink -f temp /home/user/Desktop/test

Thus we can find the full path to the file to which the softlink is pointing to .

Category: Linux | Comments Off on readlink: Finding file to which a softlink pointing to

readlink: Finding file to which a softlink pointing to

readlink is a command that can be used on a softlink to find out the file to which it is actualy pointing to. For example if we have a file “temp” which is a softlink, we can run readlink of temp as follows

$ readlink temp test

This indicates that readlink is a softlink of the file temp. If we want the full path to the file “test” we can pass the option “-f”

$ readlink -f temp /home/user/Desktop/test

Thus we can find the full path to the file to which the softlink is pointing to .

Category: Linux | Comments Off on readlink: Finding file to which a softlink pointing to

Creating a soft link.

symbolic links are used in linux to create a link to a folder or a file which is located in a different location, so that the same file or folder can be accessed from both the locations.
Softlinks are created using the command

ln -s original_file link

Example:

If we have a file “temp1” in the path

/home/user1/folder1/temp1

And if we want to create a link to this file in the path

/home/user1/folder2/

We can do it as follows.

$ ln -s /home/user1/folder1/temp1 /home/user1/folder2/link

Now if we do a long listing of the new link that was created we can see that it is a soflink by the way it gets listed

$ ls -l /home/user1/folder2/link lrwxrwxrwx 1 user1 user1 5 Aug 18 15:45 link -> ../folder1/temp1

The first letter, l, in the long listing indicates that the file is a softlink and the last column indicates the file to which it is a softlink

The new link file is just a pointer to the original file and not a new copy of it and hence it occupies just enough space required for a link, which is very very small, rather than for the whole file.
The file can be opened and modified from either of the locations, and the changes will be reflected in files at both the locations.

Category: Linux | Comments Off on Creating a soft link.

Creating a soft link.

symbolic links are used in linux to create a link to a folder or a file which is located in a different location, so that the same file or folder can be accessed from both the locations.
Softlinks are created using the command

ln -s original_file link

Example:

If we have a file “temp1” in the path

/home/user1/folder1/temp1

And if we want to create a link to this file in the path

/home/user1/folder2/

We can do it as follows.

$ ln -s /home/user1/folder1/temp1 /home/user1/folder2/link

Now if we do a long listing of the new link that was created we can see that it is a soflink by the way it gets listed

$ ls -l /home/user1/folder2/link lrwxrwxrwx 1 user1 user1 5 Aug 18 15:45 link -> ../folder1/temp1

The first letter, l, in the long listing indicates that the file is a softlink and the last column indicates the file to which it is a softlink

The new link file is just a pointer to the original file and not a new copy of it and hence it occupies just enough space required for a link, which is very very small, rather than for the whole file.
The file can be opened and modified from either of the locations, and the changes will be reflected in files at both the locations.

Category: Linux | Comments Off on Creating a soft link.

Removing grub rescue entries from grub menu

The grub2 by default creates an entry for recovery mode in its menu,using which we can log into single user mode and trouble shoot various problems in the system.

But if we do not want this entry we can remove this entry from the grub by changing the grub configuration.

Open the file

/etc/grub/default

Note : Super user privileges are required to modify the file

Edit the line

# GRUB_DISABLE_LINUX_RECOVERY=”true”

Uncomment the line by removing the “#” in front of the line.

Now update the grub by running

sudo update-grub

Next time the system is rebooted the grub menu will not have the recovery entries.

Related Blogs

    Category: Linux | Comments Off on Removing grub rescue entries from grub menu

    Removing grub rescue entries from grub menu

    The grub2 by default creates an entry for recovery mode in its menu,using which we can log into single user mode and trouble shoot various problems in the system.

    But if we do not want this entry we can remove this entry from the grub by changing the grub configuration.

    Open the file

    /etc/grub/default

    Note : Super user privileges are required to modify the file

    Edit the line

    # GRUB_DISABLE_LINUX_RECOVERY=”true”

    Uncomment the line by removing the “#” in front of the line.

    Now update the grub by running

    sudo update-grub

    Next time the system is rebooted the grub menu will not have the recovery entries.

    Category: Linux | Comments Off on Removing grub rescue entries from grub menu

    Making the grub beep on displaying the menu

    In grub2, when the menu is displayed it by default does not make any sound to alert the user about the display.
    This behavior can be changed so that the grub creates a beep sound as soon as the grub menu gets displayed, so that the user, if he or she is not looking at the monitor, gets notified about the display.
    Open the file

    /etc/default/grub

    and go to the line

    # GRUB_INIT_TUNE=”480 440 1″

    Uncomment the the line by removing the “#” in the beginning.

    Save and quit the file.
    Now run the command

    $ sudo update-grub

    Now reboot the system and we should be able to hear a beep when the grub menu gets displayed.

    Related Blogs

      Category: Linux | Comments Off on Making the grub beep on displaying the menu

      Making the grub beep on displaying the menu

      In grub2, when the menu is displayed it by default does not make any sound to alert the user about the display.
      This behavior can be changed so that the grub creates a beep sound as soon as the grub menu gets displayed, so that the user, if he or she is not looking at the monitor, gets notified about the display.
      Open the file

      /etc/default/grub

      and go to the line

      # GRUB_INIT_TUNE=”480 440 1″

      Uncomment the the line by removing the “#” in the beginning.

      Save and quit the file.
      Now run the command

      $ sudo update-grub

      Now reboot the system and we should be able to hear a beep when the grub menu gets displayed.

      Category: Linux | Comments Off on Making the grub beep on displaying the menu