Linux / UNIX: Kill Command Examples

The kill command is used to send a signal to a process. The signal can be used to terminate the process or to instruct it to perform some action, such as reloading its configuration file. Here are some examples of how to use the kill command in Linux/UNIX: To terminate a process with a specific … Read more

Unix Command To Rename A Folder

The mv command can be used to rename files in UNIX. Here is the syntax: mv old_filename new_filename Here, old_filename is the name of the file you want to rename, and new_filename is the new name you want to give to the file. For example, to rename a file named file1.txt to newfile.txt, you would … Read more

Linux Restrict Execution of /usr/sbin/userhelper to Console Users

The /usr/sbin/userhelper program is used by the useradd, usermod, and other user administration utilities to provide a graphical interface for adding, modifying, or deleting user accounts. By default, any user can execute /usr/sbin/userhelper, which can be a security risk. To restrict the execution of /usr/sbin/userhelper to console users only, follow these steps: Edit the /etc/pam.d/userhelper … Read more

yum Download All Source Packages (SRPM) From RedHat / CentOS WebSite

To download all source packages (SRPM) from RedHat or CentOS website using yum, you can use the yumdownloader command. Here’s an example command to download all source packages from the base repository of CentOS 7: yumdownloader –source –destdir=/path/to/download/directory –disablerepo=* –enablerepo=C7.0.1406-base * This will download all source packages from the base repository of CentOS 7 to … Read more

Linux / UNIX: Sed Replace Newline (\n) character

In sed, the newline character can be replaced with the \n escape sequence. To replace newlines in a file, use the following command: sed ‘:a;N;$!ba;s/\n/ /g’ inputfile > outputfile This command reads the entire input file into the pattern space, replaces newlines with spaces, and writes the result to the output file. Alternatively, to replace … Read more

Linux Load USB Driver

To load a USB driver on Linux, follow these steps: Plug in your USB device. Open a terminal window. Type the following command to check if your device has been detected by the system: $ dmesg | tail This will display the last few messages from the system log, which should include information about your … Read more

How To Upgrade FreeBSD 7.0 to 7.1 Stable Release

Upgrading a FreeBSD system from one release to another involves upgrading the base system files, the kernel, and the installed software packages. Here’s how to upgrade from FreeBSD 7.0 to 7.1: Update the ports tree and installed packages: # portsnap fetch update # pkg update Install the freebsd-update tool if it’s not already installed: # … Read more