≡ Menu

To allow a user to use shutdown, halt or poweroff, you must allow the user to use sudo and then add the commands in the sudo list of commands that the user can run. For example, I want the user ewhathow to be able to shutdown the system. [root@server java]# which halt /sbin/halt [root@server java]# [...]

{ 0 comments }

How to list all files in an rpm file?

RPM or red hat package manager is a utility in RPM based systems like Red Hat, Fedora and CentOS. It provides a very convenient way to install and query packages on a Linux system. To query an RPM file for all files in it, just use the --list argument: [root@server java]# rpm -q --list httpd [...]

{ 0 comments }

How to get changelog of an RPM package?

RPM provides a very useful way to get the change log of a package like php or Apache httpd. The changelog includes all security patches and changes that have been applied to a package. This is very useful if you want to know if a particular security patch was installed for that package. To query [...]

{ 0 comments }

How to find out CPU usage on Linux?

There are several commands that can show CPU utilization on a Linux box. Note that these commands can be used on any Linux distribution like CentOS, Debian or Ubuntu. 1) Using the top command The top command is a very versatile Linux command that can show you CPU utilization per process. It will list all [...]

{ 0 comments }

There is a command that can give you complete information about your CPU and whether your CPU supports 64 bit mode or not. The command is called lscpu: [root@server ~]# lscpu Architecture: i686 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 0 Vendor ID: AuthenticAMD CPU family: 16 Model: 9 Stepping: 1 CPU MHz: [...]

{ 0 comments }

The question - I need to find which shell I am using. Is there a Linux command that I can use in a shell script to find which shell I am currently using? There are several ways in which you can find your shell. The easiest one is to use the $SHELL environment variable: [root@server [...]

{ 0 comments }

Linux fold command tutorial with examples

The Linux command fold can wrap the long lines of a file to a smaller width to be more readable. Some files have very long lines and they need to be wrapped to be able to read it comfortably. The command fold can do that. fold -s --width=80 file.txt > file-output.txt The above command will [...]

{ 0 comments }

Rebuild Corrupt RPM Database

Sometimes, the RPM database on a CentOS, Red Hat or Fedora Linux box gets corrupt and it needs to be rebuilt. There is a simple command that can rebuild the entire RPM database. Before you rebuild the RPM database, you need to release write locks on the database. These locks are of the form of [...]

{ 0 comments }

Return 503 when server is under maintenance

When your server is under maintenance like you are upgrading your WordPress install or you are moving some pages around, it is imperative that you return the correct HTTP status code when the maintenance is going on. The correct HTTP status code to return is 503. If you return a 404 page not found, search [...]

{ 0 comments }

The Bash shell (bourne again shell) is a very powerful shell which is used by a large majority of Linux systems. It is available on all Linux distributions like CentOS, Debian and Ubuntu. The Bash shell can auto complete commands, users and hosts depending on how you use the command. For example, to complete file [...]

{ 0 comments }