Laravel Deployments using Deployer at no cost

Automating deployments for your Laravel 8 project (or any other version) on your dedicated or shared hosting sounds daunting at first. I have been at that place. For my job board back when I launched it, I started looking at tools that I could use for deployment for free. If you don’t have a budget, or you’re keen on learning how to deploy automatically or you like setting up things yourself, this is a decent option.


  • Ubuntu 20.04
  • PHP 8 & PHP FPM
  • Laravel 8.x
  • Deployer 7 by Anton Medvedev (wonderful open source tool) – we will use the latest beta with support for PHP 8

On your terminal in the Laravel project, install the package (watch out for the latest releases of Deployer)

composer require deployer/deployer"^v7.0.0-beta.16" --dev

Or if you prefer a distribution version

composer require deployer/dist:"^v7.0.0-beta.16"  --dev

Once that is done, let’s initiate which will create a deploy.php ideally at the root of the project which we’ll edit

dep init

Most of the


namespace Deployer;
require 'contrib/rsync.php';

// Include the Laravel & rsync recipes
require 'recipe/laravel.php';

set('application', 'dep-demo'); //for your reference
set('ssh_multiplexing', true); // Speed up deployment

set('rsync_src', function () {
    return __DIR__; // If your project isn't in the root, you'll need to change this.

// Files you don't want in your production server.
add('rsync', [
    'exclude' => [

task('php-fpm:restart', function () {
    run('service php8.0-fpm restart');

// Hosts
->setRemoteUser('your_SSH_user') // SSH user
->setDeployPath('/var/www/website')  // Deploy path
->setIdentityFile('~/.ssh/id_rsa'); // Your SSH key

after('deploy:failed', 'deploy:unlock'); // In case your deployment goes wrong

desc('Deploy the application');
task('deploy', [

Deployer 7 has the recipes for most of your common tasks built-in, which is great. You can see the list of available recipes.

Once this is all setup, all you have to do is run and that should be do everything you’ve described

dep deploy

You should see a new folder structure in your host, where it has releases and a release folder. Deployer syncs your code to your server using rsync, runs your tasks and then creates a symlink to point to the release folder which contains your latest code.

So make sure that you point your webserver to /var/www/website/release, restart your webserver, and you should be good to go.

If you’re looking for automating this using GitHub Actions, take a look at this great guide by Atymic – it’s what helped me discover this tool and guided me on the entire process.

Laravel News Links

You Can’t Fight a Guy with a Baby

You Can’t Fight a Guy with a Baby


In this classic sketch from Key & Peele, a guy bumps into another guy on the playground and gets into an altercation. But will the baby that he’s carrying be a help or a hindrance as he takes on his foe? Click play and find out.

The Awesomer

8 Popular Bolt-Action Rifles [Ultimate Guide]

If you’re looking at the popularity of certain firearms and wondering if you should buy what’s trending…

There’s an old saying that sometimes comes to mind, “If all your friends jumped off a bridge, would you jump, too?”

Remington 700
Remington 700…a popular gun you’ve probably heard name dropped.

It’s usually asked to make kids question the mob mentality of negative peer pressure.

Just because “everybody’s doing it” doesn’t automatically mean it’s the best decision for you.

But sometimes it does…

Jump off Cliff
You just don’t understand, Mom!

In the world of firearms, and especially bolt guns, there are insanely popular guns everyone seems to jump to buy.

But you might ask yourself, “Should I jump into this model, too?”

If you’re in the market for a new bolt-action rifle and you’re wondering if you should follow the well-traveled path or forge your own, we’re here to help.

Savage Arms Rascal & B22 G
Savage Arms Rascal & B22 G — both bolt-actions.

We’re going to take a look at the most popular bolt-action rifles on the market, what they have to offer, what makes them so popular, and whether or not you should follow the crowd.

Table of Contents


What is a Bolt-Action Rifle?

Before diving headfirst into the world of bolt-actions, let’s talk about what makes this style of firearms unique.

If you’ve ever watched a sniper movie, you’ve seen a bolt-action.

Gemini Man Sniper

They’re commonly used in media for precision-like scenes because, well, they’re pretty precise.

Winning fanfare among military and SWAT snipers as well as hunters and long-range shooters, these rifles have been around the block a few times.

With a bolt-action, the user manually feed and ejects each round by manipulating the bolt on the side of the rifle. This bolt rotates, can be pulled to the rear, rotated, then pushed back into place.

Want to read up on the advantages and disadvantages (or learn more about other types of actions)? Head over to our Guide to Rifle Actions.

With that out of the way, let’s get to the most popular bolt-actions!

Most Popular Bolt-Action Rifles on the Market

1. Bergara B-14

The Remington 700 has been around for more than 60 years.

Although Remington created countless versions of the 700 over the years, they all share the iconic “Three Rings of Steel” cylindrical receiver.

The design provides a better bedding surface than previous bolt-action designs, which basically translates into repeatable downrange accuracy.

Hog Hunting Rifles Remington 700
Remington 700

Sadly, Remington themselves just aren’t the brand they used to be. If you can find a pre-2008 Remington 700 — go for it! But otherwise… you might want to choose one of the outstanding clones on the market.

Rifles like the Bergara B-14 use the same action pattern as the R700, but have much higher quality control and produce an outstanding rifle!

Made in Bergara Spain, their whole B-14 line is a workhorse set of rifles that cover everything from hunting to long range precision shooting.

If you want to get an American made near custom rifle, Bergara offers their Premier line that is USA made and offers even higher quality.

Bergara B-14 HMR
Bergara B-14 HMR

at GunPrime

Prices accurate at time of writing

Prices accurate at time of writing

2. Ruger American

The Ruger American is an absolute workhorse-of-a-rifle — rugged and tough, just like a hard-working American.

The Ruger American features a lightweight, ergonomic synthetic stock and a cold hammer forged barrel.

It also comes with a crisp, adjustable trigger and a free-float barrel.

Enter the Ruger American Predator Rifle
Ruger American Predator Rifle

Add all that up and you get a versatile rifle that produces MOA accuracy straight from the factory.

And it has a price tag that makes buying one almost feel like stealing.

It’s easy to understand why dealers can’t keep these things on the shelves.

See our full review of the Ruger American here.


at Brownells

Prices accurate at time of writing

Prices accurate at time of writing

3. Mossberg Patriot

The Mossberg Patriot has the classic look and feel of a hang-over-the-mantle, pass-it-down-to-your-grandson kind of rifle.

Since it’s built with Mossberg quality, it’s actually worthy of heirloom status, even if you decide to forego the glossy chestnut stock for a lightweight synthetic one.

Mossberg Patriot 30.06 with VX Freedom 3-9x
Mossberg Patriot 30.06 with VX Freedom 3-9x

The Patriot uses a fluted, free-float barrel, a user-friendly adjustable trigger, and a spiral fluted bolt.

Although the Mossberg Patriot certainly doesn’t have the celebrity-level popularity of a Remington 700 or a Mauser M94, there are plenty of Patriots out there stocking freezers, protecting livestock, and plinking cans every single day of the year.

The Patriot’s quality build and economy price tag should be enough to land it solidly on a B-list of the most popular bolt actions.


at Palmetto State Armory

Prices accurate at time of writing

Prices accurate at time of writing

4. Browning X-Bolt

Why is the Browning X-Bolt so popular? Well…it’s a Browning, so it should almost go without saying.

However, the X-Bolt has plenty to offer beyond its recognizable and respected brand name.

The X-Bolt brings a level of accuracy usually reserved for custom rifles, which definitely does more for its popularity than the brand’s legacy.


The rifle features a free-float barrel, a crisp, no-creep three-lever trigger, and a 60-degree bolt lift that promotes fast, easy cycling.

Each rifle also comes standard with an Inflex recoil pad that supports “a directional deflection of recoil forces.”

Browning X Bolt Left Handed
They make lefty friendly models too! (Photo: Browning)

What does that mean?

Essentially it makes the recoil a helluva lot easier on your shoulder and reduces muzzle climb.

So, you can more efficiently recover from each shot, get back on target, and hit it with accuracy. 


at Palmetto State Armory

Prices accurate at time of writing

Prices accurate at time of writing

Tried the Browning X-Bolt? Give it a rating below.

5. Weatherby Vanguard

Both of Weatherby’s bolt-action models, the Mark V and the Vanguard, are well-loved by hunters and target shooters the world over.

Both are high-quality rifles.

Weatherby Mark V Backcountry
Weatherby Mark V Backcountry

While we’ll admit the Mark V performs better than its younger brother, we’re giving a slight popularity edge to the Vanguard for one reason — it’s cheaper.

While most of us would love an unlimited firearms budget — top of my wish list if I ever find an Aladdin-style lamp that needs polishing — the average American gun owner must make concessions, pinch pennies, and continue to scour thrift stores and flea markets for antique lamps.


at Palmetto State Armory

Prices accurate at time of writing

Prices accurate at time of writing

The Vanguard is a great weapon, don’t get me wrong.

However, Weatherby cuts corners by outsourcing production, dropping four lugs in the action design, and using a two-stage trigger in place of the true zero-creep break of the Mark V’s TriggerTech.

There are a few other differences, but it’s really hard to notice them on the showroom floor.

Weatherby guarantees sub-MOA accuracy from both models.

Weatherby Vanguard (Aussie Hunter)
Weatherby Vanguard (Aussie Hunter)

Honestly, both rifles are solid, dependable, and plenty accurate.

Is the Mark V a nicer rifle? You bet your britches it is.

However, the Vanguard is awesome in its own right, When held in skilled hands, it performs just as well as the Mark V in the hands of the average shooter.

My advice, buy the more popular and significantly cheaper Vanguard, and then work on improving your shooting skills.


at Sportsman’s Warehouse

Prices accurate at time of writing

Prices accurate at time of writing

6. Savage Arms Model 110

The Savage 110 is “the oldest continuously manufactured bolt-action rifle in North America.”

Designed in 1958, the Model 110 occupied tens of thousands of deer stands across multiple generations.

Originally designed to provide the average American hunter with a strong, powerful hunting rifle, it also manages to be lightweight and relatively affordable.

Savage Model 110
Savage Model 110

Today, thanks to the Model 110, Savage is currently one of the largest bolt-action rifle makers in America.

One of the Savage 110’s best selling points comes in the form of its patented AccuTrigger — which was added to the design in 1966.

Plenty of other gun manufacturers have attempted to copy the AccuTrigger design, some with better success than others.

Savage 110 High Country
Savage 110 High Country (Photo: Savage Arms)

The Savage AccuTrigger definitely sets the bar for adjustable rifle triggers, and that bar is pretty freakin’ high.

Modern Model 110s also feature Savage’s AccuFit modular stock system, which allows you to adjust the stock for a perfect, personalized fit.

If you’re going to run with the crowd, your firearm should at least fit you, which is more than I can say for most fashion trends.

I’m looking at you, skinny jeans!



Prices accurate at time of writing

Prices accurate at time of writing

We rounded up some of the best Savage models here!

7. Tikka T3

Why is the Tikka T3 so popular?

It offers a lightweight, affordable, and astonishingly accurate design. If those aren’t good reasons to jump onto a trend, I don’t know what will convince you.

However, not everyone loves the Tikka. It has its haters out there.


Most of them complain about Tikka’s penchant for adding plastic parts to an otherwise sturdy, dependable gun.

While plastic is certainly something to complain about, the T3 has plenty of shining features, including a crisp, adjustable trigger and a machined action with a reduced ejection port for improved accuracy.

Tikka T3X Black
Tikka T3X Black

The T3 series received an overhaul in 2016, and the newest models got an updated, although thoroughly unoriginal, new name – Tikka T3x.

The T3x promises MOA groups right out of the packaging, which means the T3x will definitely be carrying on the crazy popularity of its predecessor.


at Palmetto State Armory

Prices accurate at time of writing

Prices accurate at time of writing

8. Mauser M98

Although it’s difficult to find exact figures, somewhere between 91 million and 125 million Mauser M98 bolt-action rifles have been manufactured since 1898.

A fair portion were produced as military rifles. No other rifle in history (except for the AK-47) even begins to approach those numbers.

The fact that the M98 is still in production today, more than 120 years later, is a testimony to the awesomeness of this rifle.

Mauser m98
The Mauser m98 is a fine gun for hunting or sport shooting.

There are also a ton of clones floating around out there, which also bolsters the M98’s celebrity.

But why does this rifle, with its century-old technology, continue to be one of the most popular bolt-actions on the market today?

One reason – it’s simple and it works.

Just Works

In an age where we adore high-tech everything, the Mauser M98 reminds us that progress simply for progress’s sake isn’t necessarily progress.

As grandpa used to say, “If it ain’t broke, don’t fix it.”

Modern Mauser M98s are beautiful pieces of art, with elegant lines, black plasma- nitrided steel components, and gorgeous high-gloss wood stocks.

Mauser 98
Mauser 98 (Photo: Mauser)

They are also beautifully accurate and ultra-reliable, which is definitely why they remain so popular a century later.

Investing in a brand new M98 will require you to drop some serious cash (think five figures).

Is it worth it? Maybe.

However, if you’re on the fence about spending that many C-notes, the Mauser M-18 is another solid option.

Dubbed “The People’s Rifle,” the M18 is a modern, and significantly more affordable, rendition of the classic Mauser bolt-action.


at EuroOptic

Prices accurate at time of writing

Prices accurate at time of writing


It isn’t always a good idea to do something just because everybody else is doing it. But in the case of these bolt-actions, following the crowd is a smart choice.

From Mausers to Weatherbys, these guns earn their hype.

Savage Arms Rascal
(Or for your littlest shooter, try a popular youth bolt gun — the Savage Rascal.)

Several of them also made our list of the 9 Best Deer Hunting Rifles You Can Still Buy, which we think totally adds to their popularity.

Did we leave off something you think deserves a spot on the A-list? Tell us about it in the comments below. For even more rifle action, check out the Best Sniper & Precision Rifles for Beginners.

The post 8 Popular Bolt-Action Rifles [Ultimate Guide] appeared first on Pew Pew Tactical.

Pew Pew Tactical

Avoid Pivot Table and Use Json Column in Laravel

Avoid Pivot Table and Use Json Column in Laravel

Posted By

Mahedi Hasan




Laravel 8.x

September 17, 2020

Hello devs

In this tutorial i show you how we can avoid pivot table and how we can do same stuff without making pivot table. Simply think we make many to many relationship then sometimes we need to make pivot table like one post has many categories and one categories has many post. That time we use pivot table like post_categories.

But in this table we will show our data like post with categories, or post according to category using json column in our post table. For avoiding pivot table we can reduce one table from our database schema and of course our database performance will be better than before.You will also learn how to insert json data into mysql using laravel. 

Which one is better for connection? Pivot table or JSON? You will be clear from this article that laravel remove pivot from json in laravel. So let’s start our tutorial laravel model json column.

Preview : Post table after inerting data



Preview : Post with category name



Preview : Post according to category id

laravel model json column


Step 1 : Create Model

In this we need two model. One is category model and other is post model. So let’s create it.

php artisan make:model Post -m
php artisan make:model Category -m


Now open both model and update like below image.


namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Casts\Json;

class Post extends Model
    protected $guarded = [];

    protected $casts = [
        'category_id' => Json::class



and open migration file and update it like below.


public function up()
   Schema::create('posts', function (Blueprint $table) {


Step 2 : Create Route

We need many route for creating post or showing post according to category. So open web.php and update it like below.


Route::name('admin.')->namespace('Admin')->prefix('admin')->group(function () {

//Post Route



Step 3 : Create Controller 

In this step we need to create post controller. So create it by the following command.

php artisan make:controller Admin/PostController


And update it like below.


namespace App\Http\Controllers\Admin;

use App\Category;
use App\Http\Controllers\Controller;
use App\Post;
use Illuminate\Http\Request;

class PostController extends Controller
    public function show_post_form()
    	return view('');

    public function store(Request $request)
          'category_id' => 'required',
          'title' => 'required'

    	$post = new Post;
    	$post->category_id = json_encode($request->category_id);
    	$post->title = $request->title;
        return redirect()->back();


    public function index()
    	$post = Post::all();

    	return view('',['posts' => $post]);

    public function category_post($id)
      return Post::whereJsonContains('category_id',$id)->get();


Step 4 : Create Blade File

Now we are in the final step. So how to insert json data into mysql using laravel we will know that now. No create below file and paste this code in your file.




Laravel News Links

Human vs. Airplane Engine Simulation

Human vs. Airplane Engine Simulation


(Gore) You never want to stand directly in front of a jet engine, as its powerful vortex could suck you right into it. CG animator atomic marvel used a physics simulation to toss a particle-based digital body into an Airbus jet engine. We’re not sure about its accuracy, but the results are much like those Will It Blend? videos.

The Awesomer

The 5 Best Mac Image Viewer Apps With Unique Features

Finder’s Gallery view lets you scroll through folders of photos on your Mac with an enhanced preview pane and rich metadata. Preview works fine for basic use, but it lacks navigation controls, superior viewing experience, and other features.

You don’t need an app like Apple Photos, Adobe Lightroom, or one that supports databases to update and organize your collection while displaying images. We’ll show you some of the best photo viewer apps with unique features for Mac and how you can use them.

1. XnView MP

XnView MP is a photo viewer, manager, and resizer for Mac. The built-in tools let you organize images in multiple ways and process them with an arsenal of editing tools while offering batch conversion modules and support for numerous image formats.

When you launch the app, you’ll see three panels.

The left sidebar is the Finder file system, with a section tabs—Folders, Favorites, and Categories Filter. It consists of pre-configured categories to aggregate and label your images.

The center panel shows a thumbnail preview of each photo. Navigate to View > View As and select Thumbnails + Labels to show the details. You can sort images by name, file size, EXIF date taken or modified, or even filter them by rating, comments, or tags.

On the right side, you’ll see a preview panel. Info lets you see file properties, histograms, and EXIF data. Switch to the Preview panel to check out the image.

Unique Features of XnView MP:

  • Support of old, non-standard, Photoshop, Corel, Autodesk, and HEIF image formats. Click Create to split or join images and create multipage image files.
  • It can handle RAW file format and uses the GPU to improve performance, caching, and processing. It also supports a full internal bit depth picture of 8, 16, or 32 bits per component.
  • Customize the layout of the app as per your needs. Navigate to View > Layout, or select Free to create a custom layout.
  • Integrates with XnConvert to convert images, resize batches of images, and apply adjustments like rotation, watermarks, filters, fancy effects, and more.
  • Lets you create custom slideshows with parameters for setting up a timer (or keyboard press), changing screen size, adding transition effects, and adding background music.

Download: XnView MP (Free)

2. ApolloOne

ApolloOne is an image viewer app for Mac to view and organize photos. The built-in camera RAW decoder can generate a preview of an image directly from the RAW file. With the Lanczos filter, it can scale your image back to its original quality.

To access your photos, click the Browser button in the toolbar. Then click the plus (+) button and select Folder. You can group related folders by adding a separator.

Double-click a photo to open it. Then press the left or right arrow keys to see your photos. Thumbnails are generated on the fly using a multi-core processing engine. For Macs with a GPU, the app can speed up the display of images and quality.

Head to Preferences > Advanced and turn on High quality image scaling option. You can zoom in or out of the photo. Press the Control key to instantly zoom to a particular magnification.

The Inspector panel shows you detailed shooting info from a camera JPEG or camera RAW file. To inspect any image, press Cmd + I or click the Inspector button in the toolbar. On a supported camera, the info page can reveal the serial number, shutter count, and other specifications.

Unique Features of ApolloOne:

  • It provides a glance view of images at the top of the viewer—like a film strip (Tools > Show Filmstrip).
  • ApolloOne lets you set the source of the metadata. It supports both macOS extended attributes (used by Finder searches) and XMP. Turn on Spotlight indexing to search images by different EXIF parameters.
  • It offers you an adjustment panel to help with the assessment of a RAW image. This includes exposure compensation, highlights and shadows adjustment, and an Auto Tone curve.
  • The built-in contact sheet mode (View > Contact Sheet) displays the thumbnails in a grid fashion. With it, you can perform file operations in bulk.
  • You can add a Smart Folder created by Finder to access your photos according to your needs. It even supports Finder tags and lets you use a combination of tags for further filtering. Here’s how to use smart folders on a Mac.

Download: ApolloOne (Free, premium version available)

3. qView

qView is a cross-platform, minimal image viewer app for Mac. On launch, you’ll see a black window. Navigate to File > Open and choose a folder to display its contents. Then, press the left or right arrow keys to navigate between the photos.

Scroll to zoom in or out and control-click any picture to access more options. You can rotate images, flip images, or switch to the original size and view them in detail.

Unique Features of qView:

  • qView supports GIFs, allowing you to increase or decrease the speed or save a specific frame as a PNG or JPEG.
  • View photos in slideshow mode (Tools > Start Slideshow). You can customize the slideshow direction, timer, and preload settings.
  • It offers you shortcuts to navigate and access different options, and usability. Check the Shortcuts tab in preferences.
  • By default, the title bar shows the file name. Head to Preferences > Windows and check the Verbose option under the Titlebar text to show you more details.

Download: qView (Free)

4. Picturama

Picturama is a modern-looking, electron-based, picture-viewing Mac app that lets you quickly view images. The app supports JPEG, PNG, TIF, WebP, HEIC, and HEIF. It also reads the RAW file for a bunch of cameras through the LibRaw libraries built into the app.

To get started, click the Settings button and choose a folder.

You can browse the photos by date using the stylish progress bar on the right. Choose a year and month, and directly navigate to your photos.

Press the i button to see the information and EXIF data of an image. Click the flag button to add that image to your favorites.

Unique Features of Picturama:

  • It can retrieve comprehensive EXIF, IPTC, MakerNotes, and XMP information of the detailed Info page.
  • You can add a tag, but it has no relation with the Finder.
  • Rotate and crop your photos. You can zoom in or out with the slider in the toolbar or mouse wheel.
  • Export photos in formats like JPEG, PNG, or WebP. When doing this, you can set the quality, size, and remove EXIF data.

Download: Picturama (Free)

5. Lyn

Lyn is a Mac photo viewer and organizer. It supports non-standard, old, and RAW image formats. With the built-in support of camera models and multi-threading, it can progressively scale high-resolution images.

The left sidebar displays all your folders (including Smart Folders), photo libraries, devices, and mounted volumes.

The viewer displays the image and has view options like—Icon, Strip, List, and Map view mode. The map layout mode uses Apple Maps with GPS data to provide visual location information. And the list view mode shows the image thumbnail, detailed information, and metadata.

At the right, you’ll see the Inspector panel. It displays information like type, color space, EXIF, makernote, IPTC, GPS, and more.

Browse your photos either using strip view mode or by double-clicking a picture and using the left or right arrow keys. You can use different zoom methods and use shortcuts to magnify the image at the cursor level.

Lyn can also sort the photos in many ways, like name, date, color label, tags, and rating. Or it can filter them by name, extension, and tags in the search field.

Unique Features of Lyn:

  • This app uses ColorSync color management technology, from source to printing. It can detect the color profile (through ICC) from the image, embedded profile, EXIF, or camera makernote.
  • You can rate, assign keywords, or tags to your photos. It’s also possible to create a smart folder with tags, so you can easily find files. Under the Search For tag, you’ll find all your Smart Folders.
  • When you connect a camera, expand the Devices section and start importing your photos. It can even import from a card reader, hard disk, or NAS.
  • Lyn includes a non-destructive filtering engine to adjust color, exposure, contrast, enhance the shadows, apply a sepia filter, convert to black and white, and more. You can even straighten or crop an image and later revert them.
  • Publish your photos directly to Flickr, Dropbox, and SmugMug. The user interface is built into the app itself.

Download: Lyn ($29.99, free trial available)

Free and Paid Image Editors

Although viewing images seems like a simple operation, people may have a variety of use cases for it. The apps discussed in this article cover a wide range of options for different professionals and edge cases. Try out these apps yourself to see which one fits your needs best.

If you’re looking to edit these images, then you require an image editor. All these image viewers have the option to Open with an image editor of your choice. If this interests you, take a look at the best free and paid image editors for Mac to find the best option.

MUO – Feed

How Fishing Line Is Made

How Fishing Line Is Made


Some fishing lines are monofilament, while others are braided from multiple strands. Science Channel takes us inside a factory that produces braided line, combining numerous microfibers into a single strong one, then bathing them in dye for color. They show how they make a smooth line that’s been coated in resin.

The Awesomer

Securely Copy Files in Linux With the Scp Command

There are times when you want to transfer files between your local system and a remote server. Several protocols and methods are available that allow you to handle file transmissions in a secure manner.

The scp command in Linux is one such tool that helps a user in sharing files remotely between local and remote hosts. In this article, we will discuss the scp command in detail, along with its usage and some additional features of the command.

What Is the Scp Command

Scp, an acronym for Secure Copy, is a command-line utility in Linux-based operating systems that allows a user to copy files between remote and local hosts. Since the command transfers files over a network to some other host, SSH access is required. SSH (Secure Shell) is a protocol that allows you to handle network services securely over any network.

The scp command also supports some additional features such as specifying authentication parameters, changing the port, transferring directories, and more.

Why Scp Is Better Than Other Methods

Scp is usually preferred over other file transfer methods because, during the transfer, the connection between the two hosts is encrypted. The SSH protocol is responsible for encrypting the files, passwords, and any other sensitive details.

Other transfer methods such as Telnet or FTP do not have any encryption. Also, the user/password keypair is also saved in plain text which is not a good practice at all. A cracker can easily access your information by sniffing your network.

How to Securely Transfer Files Using Scp

Using the scp command, you can transfer files between:

  1. A local host and a remote host
  2. A remote host and a local system
  3. Two remote hosts

Basic Syntax

The basic syntax of the scp command is:

scp [options] [source] [destination]

Transfer From Local Host to a Remote System

If you are a server administrator, then transferring files between a local host and remote hosts might be useful to you. To upload a file named document.txt to a remote host:

scp /home/document.txt user@remote-host:/home/document.txt

Note that the source is the path of the file on your local storage. And the destination is the path of the file on the remote host. You have to specify the username and domain name of the remote server as well. In the above command, user is the username and remote-host is the domain name.

The destination path is separated from the remote host details using the colon character (:). Keep in mind that the user must exist on the remote server if you want to transfer the files successfully. Also, the user should have write access to the directory in which you want to save the file.

After issuing the above-mentioned command, the system will ask you for the remote user’s password. Type the password and press Enter.

user@remote-host's password:

If the password is valid, the file transfer will initialize. If you entered an incorrect password, an error will occur.

Before trying to copy the file using the scp command, ensure that the remote host details and the password are correct by logging in to the server using SSH.

From a Remote Host to Local Host

To copy files from a remote host to a local host, just interchange the source and destination path in the scp command.

scp user@remote-host:/home/document.txt /home/document.txt

The system will ask you for the remote user’s password once again. Enter the password to confirm the transfer process.

Between Two Remote Hosts

To copy files between two remote servers, both the source and destination paths must be directories on the remote hosts.

scp user1@remote-host1:/home/document.txt user2@remote-host2:/home/folder/document.txt

Again, a prompt will appear asking you to enter the password for each of the two users.

Scp Command-Line Options

Apart from simply transferring the files from source to destination, scp has some additional options that can be invoked using specific arguments.

Change the Port

By default, the scp command works on port 22. However, you can always overwrite the default configuration and change the port. The -P flag allows you to do the same.

To use some other port number while copying files from a local host to a remote host:

scp -P 35 /home/document.txt user@remote-host:/home/document.txt

The aforementioned command will ensure that the scp command uses port 35 for transferring files.

Preserve File Timestamps

You might know that Linux sets timestamps for each file to store the modification time, access time, and change time associated with the file. When you transfer the file to another location using scp, the timestamps of the destination file are overridden by the current time.

If for any reason you want to preserve these timestamps, use the -p flag. Notice that -P and -p flags are different from each other.

scp -p /home/document.txt user@remote-host:/home/remote/document.txt

Copy Directories

If you want to copy directories instead of files, use the -r flag to transfer directories recursively.

scp -r user@remote-host:/home/videos /home/videos

Suppressed Mode

When you enter the scp command in order to transfer files, the terminal displays the progress bar and other related information on the screen. However, you can choose not to view this information using the -q flag.

scp -q user@remote-host:/home/document.txt /home/document.txt

Use a Keypair File for Authentication

If you want to authenticate the remote host connection using a keypair file, specify the path of the file using the -i flag.

scp -i /home/keypair.pem /home/document.txt user@remote-host:/home/document.txt

Chaining Multiple Flags Together

Just like any other Linux command, you can chain multiple arguments together to make the scp command more effective.

For example, to change the port and transfer files in suppressed mode:

scp -P 34 -q user@remote-host:/home/document.txt home/document.txt

If you want to use a keypair file for authentication and need to copy directories to the destination path:

scp -i /home/secret/keypair.pem -r /home/folder user@remote-host:/home/folder

File Transfer Between Linux Systems

In the world of the internet, transferring files between systems has become an essential task. For those who are administrating Linux servers, sometimes it is important to take a backup of the server before issuing a specific command. In situations like this, the scp command comes in handy.

Similarly, the cp command helps in copying the files from one location to another in a local system. There are many basic commands that are a must if you’re just getting started with Linux.

MUO – Feed

80 Laravel Interview Questions–rTABY4Xn–/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/

Hi everybody. If you’ve recently been invited to a Laravel interview, or you want to improve your skills about this framework, in 80 questions, we are going to discover more about Laravel. 😉

A Friendly Tip

These questions improve your general and technical knowledge about Laravel and prepare you for interviews. In this series we are going to explore something like Event/Listeners briefly. Knowing these items doesn’t guarantee that you will pass the interview! Passing the interview is hugely depends on how you are going to implement these items. For example you may be asked to make a program using Job/Queue.

Laravel has a lot of features and no one can claim that he/she knows everything about Laravel and is able to implement everything in the best way. Even it’s main developers!

So the best approach is to grasp basic knowledge about most Laravel features and be able to implement only some of these features in the best way. Companies aren’t looking for a person who knows everything. And the one who claims that he/she knows everything, will be likely rejected because of being overqualified which means he/she is good more that expectations.

So don’t worry if you don’t know everything. The thing is, you must know a few things like a hero 💪

Ok, let’s start.

What are we going to explore?

In this series we are going to answer these 80 questions:

Part 1:

  1. What do you know about Laravel?
  2. What are differences between Laravel and Lumen?
  3. Name a few important directories of the framework
  4. What does bootstrap directory do?
  5. What is the usage of middleware?
  6. What is Artisan?
  7. What are differences between has and filled methods in the Request class?
  8. What is ORM?
  9. What is Eloquent?
  10. Name some important Laravel relationships

Part 2:

Will be added soon

Part 3:

Will be added soon

Part 4:

Will be added soon

Part 5:

Will be added soon

Part 6:

Will be added soon

Part 7:

Will be added soon

Part 8:

Will be added soon

Laravel News Links