Recognition

Posts

28 Posts
  • Published Question

    How to Trim String in bash?

    Hi all, Is there an easy way to trim a string in bash? For example if I wanted to trim a string with JS, I could simply do string.trim();. However as far as I can see there is no such command in bash: command trim Th...
    Accepted Answer: Hello, There are multiple ways to do this depending on what exactly you would like to achieve. One of the most straight forward ways to trim a string in bash is to use the xargs command. Here's a quick example: bash e...
    1 By bitmap Linux Basics Linux Commands
  • Published Question

    How to Tweak MySQL/MariaDB Configuration for Increased Performance and Stability?

    Hi all, Do you have any suggestions on how to make sure that MySQL/MariaDB is configured properly for optimal performance and stability? Thanks!
    Accepted Answer: Hello, What you could do is use the MySQLTuner script (https://github.com/major/MySQLTuner-perl). The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you sug...
    1 By bitmap MySQL MariaDB Linux Basics
  • Published Question

    What is your favorite shell and why?

    Hi all, I'm just getting started with Linux and I've been experimenting with different shells like bash, sh and fish. So far I quite like fish because it is quite friendly and interactive shell. What is your favourite...
    4 By bitmap Linux Basics Linux Commands
  • Published Question

    How to Installing Siege Stress Tester on a CentOS Server?

    Hi all, I want to do some stress testing for my application. I read this article here on the introduction to load testing: https://www.digitalocean.com/community/tutorials/an-introduction-to-load-testing But I was not...
    Accepted Answer: Hello, First, you need to get the Siege source files. Here's a link to the current siege repo: http://download.joedog.org/siege/ As an example here would go with siege-3.1.4: cd /opt wget http://download.joedog.org/s...
    1 By bitmap Linux Basics Linux Commands
  • Published Question

    How to install Drush without root access on a shared cPanel server?

    Hi, I have a shared cPanel Linux server and I don't have root access to install drush. Can you please provide me with a step by step instructions guide on how to do that? Thanks!
    Accepted Answer: Hello, In order to do that you would need SSH access. Then SSH to your server: ssh your_user@yourserver.com Then check if you have composer installed: which composer If you don't get any output install composer: ...
    1 By bitmap Linux Basics Drupal
  • Published Question

    Problem with /dev/null - Permission denied

    Hi all, I think that I've messed up the /dev/null on my droplet. When I login with my non-root user I get the following error: -bash: /dev/null: Permission denied The permissions of the file are: -rwxr-xr-x 1 root...
    Accepted Answer: Hello, The permissions do not really look correct. What you could do in this case is just recreate the /dev/null. You can do that with the following commands: Login as root to your droplet, and then run: rm /dev/null...
    1 By bitmap Linux Basics
  • Published Question

    How to free up swap if there is free RAM?

    Hi all, Does anyone know an easy way on how to free up my swap? I can see that there's enough RAM available: ``` free -m total used free shared buff/cache available Mem: 983 ...
    Accepted Answer: Hello, I would usually use the following command: swapoff -a && swapon -a & The & sign at the end would start the process in the background, then I would run the following to watch how the data is being copied from ...
    1 By bitmap Linux Basics
  • Published Question

    How to recursively copy files from one server to another via FTP from the command line?

    Hi all, I have a website hosted on another server and I want to transfer the content over to my droplet. The problem is that I only have FTP access to the old server and I don't want to download all of the files local...
    Accepted Answer: Hello, The last time I had to do that I used wget. First you need to SSH to your droplet, cd to the directory that you would like to store the files at and use wget with the following arguments: wget -mbr --user="<^>...
    1 By bitmap Linux Basics Linux Commands Ubuntu
  • Published Question

    DNS lookup for a list of domains

    Hi all, I have a list of domains (about 100 or so) in a text file called domains.txt, I want to find out the A records of all of those domains but I don't want to do it manually for each single domain. Is there a comm...
    Accepted Answer: Hello, Yes, you could use this command to do a quick DNS lookup for all of the domains in the domains.txt file: cat domains.txt |xargs -I % echo "echo % ; dig +short %" | sh Hope that this helps! Regards, Bobby
    1 By bitmap Linux Basics Linux Commands DNS
  • Published Question

    How to Automatically Generate Sitemap with Laravel?

    Hi all, I'm almost done with building a small website using Laravel. I'm now working on the SEO side of things and I want to be able to automatically generate the sitemap.xml file on let's say daily basis. Has anyone ...
    Accepted Answer: Hello, I usually use the following package for all of my sites to generate the sitemap.xml file automatically: https://github.com/spatie/laravel-sitemap The setup goes something like this: First install the package vi...
    3 By bitmap PHP Frameworks Linux Basics
  • Published Question

    How to Attach DigitalOcean Block Storage to Docker container?

    Hi all, Does anyone know if it is possible to mount a DigitalOcean block storage to a docker container and if so what is the best way to do so? Thanks!
    Accepted Answer: Hello, The last time I had to do that I used the REX-Ray storage plugin. It officially comes with DigitalOcean Block Storage support. I'll try to walk you through the whole process here: Prerequisites: You need a Digi...
    1 By bitmap Docker Block Storage Linux Basics
  • Published Question

    How do I create a simple Artisan command in Laravel?

    Hi all, I'm quite new to Laravel and so far I really like it, especially the artisan commands. Has anyone created a custom artisan command? If so can you please share the steps that I would have to take in order to do...
    Accepted Answer: Hello, Yes, artisan is great, you could use it to automate a lot of tasks. I'll try to walk you through the process of creating a simple "Hello World!" artisan command. Prerequisites: You need to have Laravel installe...
    2 By bitmap PHP Frameworks PHP
  • Published Question

    How to secure WordPress without a security plugin?

    Hi all, I have a simple site based on Wordpress with Apache webserver. I've tried using Wordfence which is a security plugin, but it slows my site quite a bit and I was wondering if any one has any basic tops on how t...
    Accepted Answer: Hello, I will try to focus purely on the Wordpress side of things, but of course, having a secure server is also extremely important. Here are some of the things that I could suggest: The basics: Always update WordPr...
    1 By bitmap LAMP Stack WordPress Apache
  • Published Question

    How do I Change the timezone on a CentOS Server?

    Hi all! I'm quite new to Linux in general so sorry for the basic question. I want to change the timezone of my CentOS server but so far I've not been able to do so. I had a look at a few tutorials but so far without a...
    Accepted Answer: Hello, Here's how to do that with just a few easy steps: Choose the zone that you would like to use at: ls -l /usr/share/zoneinfo/ Then backup your current timezone file: mv /etc/localtime /etc/localtime.bak Now c...
    1 By bitmap Linux Basics Linux Commands
  • Published Question

    How to Free Up Space in /boot on CentOS Server

    I have a CentOS box at home and I'm trying to install the latest Kernel but it is failing as my /boot partition is too small and there's not enough space. Can I just use rm and delete some of the old Kernels stored in...
    Accepted Answer: Hello, I've noticed that with CentOS by default the /boot partition is quite small, in some cases it could be only a few megabytes. If this is the case with when you try to update your kernel, you could get an error c...
    1 By bitmap Linux Basics Linux Commands
  • Published Question

    Linux not Picking up New Kernel

    For some reason, my Linux machine is not picking up the newer Kernel that I've installed. Though I can see the Kernel at the /boot folder. Has anyone had a similar problem and how did you fix it? Thanks all!
    Accepted Answer: Hello, I've had similar cases before, sometimes you would install a new kernel and you would be able to see it in your /boot folder. But on boot it would not appear in the grub menu and would not be automatically pick...
    1 By bitmap Linux Basics
  • Published Question

    How can I kill all MySQL sleeping queries?

    Hello, I've noticed that I have a lot of sleeping MySQL processes. I tried killing them one by one but there are too many to do so. Does anyone know if there is an easier way to kill all sleeping processes at once? Th...
    Accepted Answer: Hello, Yes, you can kill all of your sleeping connections with this command: for i in `mysql -e "show processlist" | awk '/Sleep/ {print $1}'` ; do mysql -e "KILL $i;"; done However, this is not a permanent solution...
    2 By bitmap MySQL Linux Basics
  • Published Question

    How can I find all of the files that have been modified in the past 24 hours?

    Hello, I think that my website has been compromised and I want to find out if there were any files modified in the past 24 hours or so. Is there an easy way to do that? Thanks!
    Accepted Answer: Hello, Yes, you can use the find command with the -mtime argument. Here's an example: find <^>/var/www/html/<^> -mtime -1 -type f -print What you could do is also put this in a small script and run it as a cronjob. ...
    1 By bitmap Linux Basics Linux Commands
  • Published Question

    Running Jenkins in Docker

    Hi all, I was wondering if anyone has ran Jenkins in a Docker container? How did you do it and are there any tips that you would share? What are the exact commands that you used to run the container with? Thanks!
    Accepted Answer: Hello, Yes, I've recently had to set that up. So far it is working pretty well! Here's a link to the official Jenkins image on Docker Hub: https://hub.docker.com/r/jenkins/jenkins Note: Make sure NOT to use the deprec...
    1 By bitmap Docker Linux Basics Ubuntu
  • Published Question

    How to install dig on ubuntu?

    Hi, when I try to use the dig command I get this error: dig: command not found I tried to install it with: apt update apt install dig But it says that the package was not found. I'm not sure what I'm missing, any ...
    Accepted Answer: Hello, Yes, you need to install another package which contains the dig command called dnsutils. To do that just run: apt update apt install dnsutils Hope that this helps! Regards, Bobby
    1 By bitmap Linux Basics Linux Commands Ubuntu