Posts

Showing posts with the label Tips and Tricks

How to Efficiently Handle Sparse Files with tar

How to Efficiently Handle Sparse Files with tar Sparse files are files that contain empty blocks, which can take up less disk space. To efficiently create and manage backups of sparse files, you can use the tar command with the --sparse option. Here's a quick guide on how to do this. Creating a Backup of Sparse Files Open your terminal. Run the following command: tar cvSf file.tar.bz2 sparsefile c : Create a new archive. v : Verbose output (optional, shows progress). S : Handle sparse files. f : Specify the output file. file.tar.bz2 : The name of your archive. sparsefile : The sparse file you want to back up. Decompressing the Backup To restore the sparse files from your backup, follow these steps: In your terminal, run: tar xSf file.tar.bz2 x : Extract files from the archive. S : Handle sparse files during extraction. f : Specify the archive file. Conclusion Using tar with the --sparse option is an effective way to back up and restore sparse files while minimizing disk space u...

SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)

This issue typically occurs when the symbolic link is not created. You can create the link using the following command: # ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl

Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] ((null):0)

The error usually arises from one of the following issues: Missing Certificate File: The certificate file may not be located at the specified path. Ensure that the file exists and the path is correctly referenced in your SSL configuration. Incorrect SSL Configuration: There may be issues within your SSL settings. Double-check your configuration files for any errors or misconfigurations that could affect SSL functionality. If neither of these issues seems to be the problem, try the following: Update the Apache Ports Configuration: Open the /etc/apache2/ports.conf file and locate the line that reads "Listen 443". Change it to "Listen 443 http". This adjustment can help ensure that Apache correctly listens for secure connections on port 443. By addressing these points, you should be able to resolve the error effectively.

Network configurations with minimal installation of Linux

Linux Network Configuration Network Configuration for Minimal Linux Installation A minimal installation of a Linux distribution, such as CentOS, RHEL, or Scientific Linux, is often the best approach. Fewer packages mean reduced vulnerability to attacks and lower resource overhead. However, you will need to adjust the network settings after the installation is complete. For DHCP Configuration Open the network configuration file: sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0 Add or modify the following lines according to your network configuration: BOOTPROTO="dhcp" ONBOOT="yes" After making these changes, the ifcfg-eth0 file should look like this: DEVICE="eth0" HWADDR="08:00:27:DB:77:F4" NM_CONTROLLED="yes" ONBOOT="yes" BOOTPROTO="dhcp" For Static IP Configuration Open the network configuration file: sudo nano /etc/sysconfig/network-scripts/ifcf...

Resolving Dual Display problem with ATI Cards in ubuntu

Open the AMD Catalyst Control Center by using the following command: $ sudo amdcccle Navigate to the Display Manager, where you will see your connected monitors. Click on the monitor you want to configure for dual display. Go to the Multiple Screen tab. Select your preferred display mode. Apply the changes and restart your system.

Passing password to ssh connection on the commmand line

~$ sudo apt-get install sshpass You can now use sshpass to provide the password in the command line as follows: ~$ sshpass -p 'mypasswd' ssh user_name@myserver.com -p 1600 Here, -p 1600 specifies that the SSH connection will be made on port 1600 of the server.

Adding Virtual nic's to *nix

Sometimes, we need to add virtual NICs to our *nix machine. To do this, copy the eth0 configuration file from /etc/sysconfig/network-scripts/ : [root@test ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1 Edit the ifcfg-eth0:1 file and remove the "HWADDR" line: [root@test ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0:1 After editing, the file should look like this: DEVICE=eth0:1 BOOTPROTO=none ONBOOT=yes NETMASK=255.255.255.0 IPADDR=192.168.56.102 GATEWAY=192.168.56.1 TYPE=Ethernet USERCTL=no IPV6INIT=no PEERDNS=yes You can then use the ifup command to bring the virtual NIC up: [root@test ~]# ifup eth0:1 In Debian and other Debian-based distributions: Open the interfaces configuration file: root@debian:~# vim /etc/network/interfaces The file will look like this: auto eth0 iface eth0 inet static address 192.168.56.101 netmask 255.255.255.0 Ad...

Demonstrating your play ground

Sometimes you may want to share what you're doing in the terminal with others. To do this, switch to the shell you want to display and use the following command: # shell_name -i |& tee /tmp/show For example: # bash -i |& tee /tmp/show Others can then view your terminal activities by typing: $ tail -f /tmp/show

Viewing directory listing

In Linux/Unix, there are times when you might want to view only the directory listings, excluding files. You can achieve this with the following command: -bash-3.00# ls -l | egrep ^d

Blocking Mass Storage in Linux

Disabling Mass Storage in Linux-Based Distros Unmount the USB device if it is currently connected: [root@centos ~]# umount /dev/sdb Note: The device name may vary in your case. Remove the USB storage module: [root@centos ~]# modprobe -r usb_storage Edit /etc/modprobe.d/blacklist.conf and add the following line: blacklist usb_storage Save the file. Now, when a USB flash drive is connected, the hotplug scripts will not load it automatically.