Like the name implies, this is a cheat sheet to quickly find the command you need, they are ordered by the frequency a command is used, or at least what i think is going to be needed more frequently, I have also grouped them by function
The container name in the examples is mycontainer, it is just a name that you will need to replace with your own container name, the container ID here is always 12345abcdef
What it does
Containers – list
docker container ls
Display running containers
docker container ls -a
a: also show containers that are not running
Display all containers, running or not
Show running containers
PS is the same as LS but older
Containers – Run
docker run --name mycontainer -i -t imagename
1- The name of the container to run (mycontainer) 2- The i flag indicating you’d like to open an interactive SSH session to the container. The i flag does not close the SSH session even if the container is not attached. 3- The t flag allocates a pseudo-TTY which much be used to run commands interactively. 4- The base image to create the container from (imagename).
Runs the container, and leaves you on a shell prompt that executes commands on that container (As if you have ssh-ed into it)
docker run --name mycontainer -d imagename
-d for running the container in the background
docker stop my_container
Stop the running container
docker exec -it mycontainer /bin/bash
-it flag allows you to run a container in interactive mode
If this doesn’t work, you may not have bash installed, you can try the next command
Gives you access to the shell, much like opening an SSH session to the container
docker exec -it username/mycontainer /bin/sh
ctrl+p followed by ctrl+q
Detach from container
Sometimes, accessing a container throght the command line may not be enough, there is a chance you want to access it for file transfer for example, in that case, you want port 22 exposed, and you want to be connected to it like you would connect to a virtual machine
On windows, you might have been using text editors that search or search&replace within files in a folder, one such tool i have used in windows is “source edit” by Joacim Andersson (Brixoft Software). that text editor does not seem to be maintained any longer as the developer seems to have moved into making games, but there are certainly many other editors that allow you to do the same thing.
On the other hand, on Linux, I don’t need to do that, the basic tools that come with the operating system allow for that, multi gigabyte files can be searched and have certain text replaced at the speed it takes to read them (Without having to open them for editing)
So, let us assume we have a folder with many text files (Including css or js or html or php files for example), to search that folder, we can combine
grep -Ril "text-to-find-here" /path/to/file/
-R (-r) look for files recursively -l show file names, not the contents that were found -i ….
Another tool which is better suited for looking in code is ack (ack-grep) which i will come back to cover in this article, and a newer tool that i have never used is
Now, replacing a string inside a file is simple, there is a cool tool called sed
sed -i '/TEXTTOFIND/ s//TEXTTOREPLACEWITH/g' verylargefile.txt
package.json is the file that dictated the dependencies for npm
So, a small comparison of yarn commands (executed in the terminal in the project’s directory which produces a build directory within that directory), the build directory is what you serve the world, in other words, it is what you put in your website’s root directory !
This part of the tutorial is a hands on setup to have Laravel working on nginx under Linux. this is not the only way to run Laravel, for all the options, see here
NOTE: Most if not all of the popular development tools are available for Linux and Windows, so If this setup is for development, you might want to install Debian Linux with the Gnome GUI so that you can install the development tools used in the next part of this tutorial, if you are going to be developing on a different machine or this is for production, then you shouldn’t.
STEP 1: Install Debian 11 (Bullseye) on a computer.
STEP 2: Install the basic Laravel environment with the following commands, Laravel 9 requires PHP 8, which at the time of writing is not available in Debian 11 repositories, so we will need to add the repositories from the guy who manages PHP for Debian anyway
The last line above should show you what version of composer you have just installed
Now, remember to never run composer as root, but rather as a regular user, from this point on I am assuming you are running the terminal as a regular user.
I understand that Debian puts the web root in /var/www/html, but i usually like to create a separate directory called /var/vhosts and put all my web projects in it
Now, we need to create a sample project for our learning and training experience
composer create-project laravel/laravel laraveltestapp
chmod -R 0777 /var/vhosts/laravelapp/storage
Next, We would need to setup nginx to serve this website (“Would like to” actually, because there are alternatives, but I’m keeping it simple), here is an almost standard template for nginx, modify the host name and project name to match your project and preferences.
NGINX vhost config file (In my case /etc/nginx/sites-available/laraveltestapp)
On linux, when i needed to edit a video I usually go to Kdenlive, I used to think it is THE linux alternative to Adobe Premier Pro, until yesterday, when a friend recommended I try out OpenShot
I am a Gnome user, Kdenlive was designed for KDE, I have always run it in gnome (Unity) and it worked fine, but today, I am feeling adventurous and up for trying OpenShot, openshot too is pyQt which is a bummer, but hey, this is not why we doing this
Reminder KDE is based on Qt and Gnome is based on GTK. both applications here are meant for KDE, and I don’t really want to install KDE on my machine
This post here is where I will leave my impressions so hang tight.