Skip to content

Instantly share code, notes, and snippets.

@SofijaErkin
Last active June 24, 2022 01:26
Show Gist options
  • Save SofijaErkin/df24156d5a00d76c6c1ea80877fc08ee to your computer and use it in GitHub Desktop.
Save SofijaErkin/df24156d5a00d76c6c1ea80877fc08ee to your computer and use it in GitHub Desktop.
Develop Linux server using C++ on Mac

Manually C++ Back-end Development On Mac

I'm a new hire that the company has recently given me a job, and I've got a

work notebook Mac, I need to code Linux server using C++ on Mac. I wonder if

is there any tips to do that?

1.First Supposition

I used to run Fedora on Mac using Parallels Desktop 11, and I heard that Docker

support Container carrying Linux on Mac, and I know that I could use Web Services

to run C++ code under Linux, as Amazon Elastic Compute Cloud(EC2: Cloud Server)

do, also, I could buy an external Raspberry Pi to run the need C++ Code at a

lower price and better solution.

So, that's clear.

Kill Linux C++ Back-end on Mac

1.Physical Linux Notebook(dual boot Linux and MacOS)

Dual boot building harmful.

2.Virtual Machine(running Linux. Connect via SSH and S FTP)

e.g: Vagrant+ VirtualBox.

This is the simplest route, but is effectively just building in Linux.

3.Docker(Linux based containers running on MacOS, via SSH and S FTP)

The docker image, this could end up being difficult to run/debug your

application and have the MacOS IDE understand error messages. Also use vagrant

instead of docker.

4.Cloud Host(remote Linux. Connect via SSH and S FTP)

Well idea.

5.[Raspberry Pi](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/)(a proper Linux computer. Could as remote Linux. Connect via SSH and S FTP)

Nice!

6.Cross GCC on MacOS

Do Not recommend!

2.Reading Plan

I'm ready to checkout the Journal, Blog, Stack Overflow, or Others.

Reading notes:

1.Setting up a Simple Docker Dev Environment

<about using 3.Docker>

Docker has two modules. The one is the static way, dependencies and testing,

or just as App release version; the another is dynamic way, application

under active development using "rsync", just as App debug version.

2.A productive development environment with Docker on OS X

<about using 3.Docker>

Edit Code at Mac, compile and test at LXC via Docker, sync the mac directory

to the virtual machine Docker. Mount my folder into my Docker via "rsync".

3.Running Docker on AWS from the ground up

<about using 4.Cloud Host>

Compute, ship and post your App using using Elastic Compute Cloud(EC2) via 

Amazon Web Services. Multiple environment using Docker in EC2 Container 

Services(ECS).

4.Infrastructure as code: running microservices on AWS using Docker, Terraform, and ECS

<about using 4.Cloud Host>

Auto build, ship and post platform via Docker, ECS and Terraform. That's

fancy and powerful. I could use that auto-idea on my Mac Docker for build,

ship or post.

5.Can you use a Mac OS to develop a C/C++ application that runs on a Linux server?

<about using 5.Raspberry Pi>

Using Raspberry Pi as external Linux computer, I could compile and test on 

it. Hook it into my network so I could just remote logo into it - and arrange

for it to share it's filing system with my Mac. At that time, I could sit 

in front of my Mac, use my Notebook Mac's editors and others stuff - and just 

have a shell window opened with an "ssh"session onto that Raspberry Pi.

If I install "apache" on that Raspberry Pi - so it'll not only like a Linux

server - it'll actually BE a Linux server. Also, I could probably even do 

full-up testing on it.

As Steve Baker said, for the sake of a few bucks and a day to get it set 

up - I'll save myself a ton of grief. 

6.Why can't I compile a C++ program on my Mac and run it on a Ubuntu server?

<about 2.Virtual Machine(running Linux)>

MacOS(Xcode/Command Line Tools) use clang-llvm with support C++14+.

7.Cross GCC on MacOSX

<about 6.Cross GCC on MacOS>

Compiling for Linux on MacOS X, This is a cross compilation of GCC:

https://gcc.gnu.org/news.html. You can find here the releases of cross

compilers for Linux 32 and Linux 64.

8.Development environment setup for Mac and CentOS using Docker

<about using 3.Docker>

It's a really good idea to use Docker to standardise the development

configuration (softwares, custom packages, env variables, ...).

9.How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant

<about 2.Virtual Machine(running Linux)>

On Linux, the VFS is shared between the host and the container, so the 

reflection without overhead is guaranteed. 

However, on macOS (and other non-Linux platforms), there is significant 

overhead for full consistency ... 

10.Shipping C++ Programs in Docker: A Journey Begins

<about using 3.Docker>

Deploying C++ applications using Docker and Kubernetes. 

The idea with multi-stage builds is that I can build the application in one

Docker container, and then copy only the production files to a second 

Docker container. 

The second Docker container can then be deployed and released to customers

without giving customers access to your source code.

Customers can run and connect to the container using Bash, but can only see 

the configuration files and application binaries.

11.How to cross compile from Mac OS X to Linux x86?

<about using 3.Docker>

"backup your container as base build image docker commit [id] centos:build"

Because if you turn down Docker, the container will miss, until you use last 

time with manually rebuild. Also, that could automate building images.

12.How to cross compile from Mac OS X to Linux x86?

<about 6.Cross GCC on MacOS>

Your simplest solution is to just run CentOS 5.3 in a VM (e.g. Sun VirtualBox).
 
This requires minimal setup, has quite reasonable overhead (assuming an Intel

Mac), and you'll be able to actually test and debug what you are building.

If you really insist on cross-compiling, you must build a cross-compiler. 

Instructions are here and here, but beware: it will likely take you several

days to get it right, and then you'll still need a VM to test the result, so 

I don't see any point in doing it that way.

13.Docker Explained: Using Dockerfiles to Automate Building of Images

<about using 3.Docker>

In this DigitalOcean article, we will see about automating this process as 

much as possible, as well as demonstrate the best practices and methods to 

make most of Docker and containers via Dockerfiles: scripts to build 

containers, step-by-step, layer-by-layer, automatically from a base image.

And,

Editing Dockerfile just like write embeded language, matlab, or python.

I wonder if is it strictly speaking a programming language? I mean that

embeded, Matlab, or python, or even R.

Automate building of Images means that package the currently created

basic image with other installed app stack into the new image via Dockerfile.

Dockerfile initial image to automate building image, and easiest migration.

14.Notes about separately installing Linux via Docker on Mac(Chinese)

<about using 3.Docker>

Create a image, then start variety of containers. There may be Nginx, Redis,

MySQL, MongoDB, or even Memcached.

15.Config LNMP environment using Docker(Chinese)

<about using 3.Docker>

(DNMP)Docker+Nginx+MySQL+PHP+Redis.

(LNMP)Linux+Nginx+MySQL+PHP.

(LAMP)Linux+Apache+MySQL+PHP.

Directory architecture:

.

|_data

|    |_elasticsearchdata

|    |_mongodb

|    |_mysql

|    |_mysql8

|_services

|    |_elasticsearch

|    |_mysql

|    |_mysql8

|    |_nginx

|    |_redis

|_log

|_docker-compose.yml

|_env

|_www

16.Develop C++ via Docker under CLion and VSCode(Chinese)

<about using 3.Docker>

Using VSCode debug remote virtual machine containers via Microsoft's'"Remote

Development", current workspace folder ".devcontainer" with "devcontainer.json"

and CMake extensions optional "Remote-Containers: Open Folder in Container".

17.The idea to config the development environment of LNMP via Docker on Mac(Chinese)

<about using 3.Docker>

The usage of Docker is that a container do only provide one service.

The designed principle of Docker is not to run services at Backend, actually

to run services at Frontend.

From downloading image command "docker pull linux_release", then, creating

container command "docker run ...", to entering container command "docker

exec ...".

I wonder if are you creating all containers under one image or one image 

with one container?

Now, I know that the auth create container one by one image, all the image

are separated, also, the container under image are separated.

And, my guess was right. There are two ways to create multiple services,

the one is that one kind image create one kind container; the another

is that all services are created below one base image with starting

one container one service.

If create all containers under only one image, that just like a physical

Linux;

If create container one by one image, that all called separated system, 

distributed system, computer cluster, or service farm.

18.Setup C/C++ development environment via Docker on Mac(Chinese)

<about using 3.Docker>

Automate Docker via four files: Dockerfile, entrypoint.sh, rsync.conf, 

docker-compose.yml. 

That's a good idea.

19.Create the development environment of DNMP via Docker on Mac(Chinese)

<about using 3.Docker>

Great DNMP directory:

.

|_conf

|    |_conf.d

|    |    |_certs

|    |    |    |_site2

|    |    |_site1.conf

|    |    |_site2.conf

|    |__my.cnf

|    |__nginx.conf

|    |_php-fpm.d

|    |    |_www.conf

|    |_php.ini

|__docker-compose.yml

|__docker-compose54.yml

|__docker-compose56.yml

|_log

|    |__mysql.slow.log

|    |__nginx.error.log

|    |__nginx.site1.error.log

|    |__nginx.site2.error.log

|_mysql

|_php

|_www

    |_site1

    |_site2

This blog also has more description about MySQL, Redis.

20.Docker build LNMP via deployer posting(Chinese)

<about using 4.Cloud Host + using 3.Docker>

"docker pull service" is to create image;

"apt-get install service" it to install services below that base

image.

Like LNMP or DNMP, one image, one container, one service;

Base image also could install many services.

21.Using Docker build up Linux server on Mac(Chinese)

<about using 3.Docker>

The installed many applications of Docker containers should be sync as a 

new sync_image.

22.Setup the development environment ofr Linux server(Chinese)

<about using 2.Virtual Machine>

The "environment installed package" of Linux release version should be 

installed separating from the system directory in order to conveniently 

delete without affecting the system directory.

"oh-my-zsh" is the functional assistant of shell zsh.

"vim7.4+" is to witness the liking lambda of C++11.

"GCC9.1" supports the C11 C14 C+=17, well error prompt.

"bison" is to solve the warming of "'bison' is missing on your system".

"textinfo" is to solve the warming of "'makeinfo' is missing on your system".

"automake1.15+" is requisite for GCC.

"autoconf2.69" is essential to "automake1.15+".

"GCC" is crucial that that is vital to more than 30 minutes to install.

"GDB8.3" is the requirement of "GCC" with installing after "GCC".

"CMake3.15" product "Makefile" with source files.

"Ragel6.10" is the limited state machine to edit the parser protocol.

Others like "psmic", "openssl-devel", "net-tools".

23.Build Linux C++ development environmnet with VS2017(Chinese)

<about using 2.Virtual Machine>

VS2017 log into virtual machine via SSH.

Linux release below virtual machine install like "openssh-server", "g++",

"gdb" and "gdbserver".

24.What's the development environment of C/C++ under Linux(Chinese)

<about using Development Tools>

editor: Jetbrains 's paid CLion, vim, MicroSoft's VSCode,

script: zsh, bash, shellcheck,

debugger: 
  
  (Online)google-breakpad; 
  
  (LIVE)gdb(functionally stack trace, that bugger home location),  

        printf(<syslog, one printf let IO console apply more resources than
        
        once IPC call syslog. Could relocate syslog, file, udp socket
        
        (receive log output), define marco to realize classify sign or 
        
        level),

        syslog(call IPC, e.g:log4cxx(support UDP log), or log file), open 
        
        source chromium's logging module,

        "UDP log" could record multiple devices's log at a time, easy to

        checkout and relocate or track. e.g: when a bugger happens, you

        could track that bugger cia UDP log, do not need to go to Test 
    
        Group to checkout their testing log,


        printk (using in printf kernel, every changed debug should be delete
        
        every time, every debug every recompile, not always function that 
        
        means not output print every time),

        systemtap, perf, kdump,

        valgrind (memory lock(dynamic mem statistics)), 

        SAFECode(LLVM subproject, to solve memory lock, faster valgrind),

memory lock: not free that applied mem, access illegal mem(Segmentation

            fault), use not initialized mem, ...

log: web checkout,

optimization: gprof,

test framework: DejiGnu, CppUnit,

single unit test: googletest,

others's code review: grep, Source Insight,

follow code: cscope, ctags, gtags,

grammar parser: global,

checkout static code: splint,

autocomplete: YouCompleteMe,

lint: pypep8, pylint, jslint,

compiler: 

  (Makefile)GNUMake,
  
  (CMake)

compiler platform: remote Jenkins(hudson), chroot

code sync: virtual machine settings share folder with VS editing code, 

"Ctrl+shift+s" syncing code, recompiling before debugging.

project: autoconf,

code style: cpplint.py, google-styleguide.google.com...,

style format: astyle, astyle.sourceforge.net/...,

document generation/organization: doxygen,

3.C++ Tools

"apt-get" is being called to update the package repository;

"build-essential" package which contains the C and C++ compilers and standard

libraries for Linux;

"autoconf", "libtool", and "pkg-config" packages are also used for building

the C++ programs;

Also, "automake", "make".

"CMake"("cmake") is a generator tool that takes a description of the build process and

can generate a Makefile for the target platform; On the Linux, it will use GCC

and G++ to build the program.

"openssh-server"

"g++"

"gdb"

"gdbserver"

"net-tools" includes "ifconfig"

"tar"

"rsync"

"python3"

"python3-pip"

"libboost-dev"

4.Source Or Library Or Application Tools

"SSH" is to connect the remote Host, the virtual Machine, that Docker contain

-ers with the local Host Mac.

"Nginx" is a architecture of server. That need: GCC environment(gcc-g++),

lib PCRE(parser Lambda: pcre, pcre-devel), zlib(compress and decompress:

zlib, zlib-devel), OpenSSL protocol(openssl).

A Beginner's Guide to Back-End Development

1.What is Back-End development?

Backend includes all the code needed to build out the database, server, and

application. From database migrations to API integrations to setting up the

server-side technologies that make a website tick, a back-end web developer

may be the talent you need to get your next web project off the ground.

2.Front-end vs back-end development

To understand the back end, or the “server side,” you also have to know the

front end and how the two interact. The front end, also called “client-side”

programming, is what happens in the browser—everything the end users see and

interact with. The back end, on the other hand, happens on the server (on site,

or in the cloud) and databases. It’s the machinery that works behind the

scenes—everything the end user doesn’t see or directly interact with, but that

powers what’s happening.

It’s important to note that this convenient way of divvying up development has

changed significantly over the past 10 to 15 years with the explosive growth of

JavaScript, which wasn’t as ubiquitous on the front end as it is now, or as

common on the back end, thanks to Node.js. There’s more overlap between the

two, especially when it comes to a JavaScript developer’s role on a fully

JavaScript-powered stack.

You can see how the server-side (in the green box) manages all those requests

that come from users’ clicks. Front-end scripts volley those requests over to

the server side to be processed, returning the appropriate data to the front

end. This often happens in a constant loop of requests and responses to the

server.

The “traditional” back end is a mix of the server, databases, APIs, and

operating systems that power an app’s front end. For an in-depth look at the

software that ties it all together, read our article on Server-Side Scripting.

The back end of applications can look very different from application to

application, whether it’s the use of cloud-based servers and data warehouses,

containerization with a service like Docker, Backend-as-a-Service (BaaS)

providers, or APIs to replace more complex processing.

3.Types of back-end languages

3.1C++

combines all the features of C with object-oriented programming features

such as classes. As a low-level programming language it is used to communi

-cate efficiently with system hardware for better performance. This makes it

ideal for video games, large web applications, and other use-cases where

system-level performance is a premium.

3.2PHP

is the most popular back-end language for the web. PHP has a low learning

curve and the benefit of a massive codebase and long history of open-source

developer community support for using PHP on the back end of websites. If

you’ve ever set up a personal website with WordPress, PHP was powering the

back end from behind the scenes.

3.3Ruby

Developed in the mid-1990s by Yukihiro “Matz” Matsumoto, Ruby is a

dynamically-typed general-purpose programming language that’s known for

programmer productivity. It supports procedural, functional, and

object-oriented programming paradigms and is known for its ability to

incorporate metaprogramming into apps (code that can change while it's running).

3.4Perl

Developed by Larry Wall in the 1990s, Perl is a general purpose programming

language that’s popular in the Linux and Unix world. Perl’s strengths lie in

text manipulation and log management. It’s great for writing short automation

scripts on the fly.

3.5JavaScript

While traditionally considered a front-end scripting language, the introduc

-tion of Node.js showed the world that this general-purpose object-oriented

programming language could also be used on the server-side of applications.

As one of the core technologies of the web, JavaScript is now a popular

choice for front-end and back-end web development.

4.Back-end tools & technology

To simplify things, we’ll break the server side down into four main components of a

“software stack”: the server, the database, the operating system, and the software.

(1).Of your back-end stack’s four components, whether it’s on-site or in the

cloud,the server acts as the lifeblood of the network. These high-powered

computers provide shared resources that networks need to run, including file

storage,security and encryption, databases, email, and web services. Once

you’ve gotten the basics down about on-site servers, expand your knowledge with

a look at virtualization, how servers get provisioned to house multiple apps,

and containerization, another way servers provision their operating systems out

to house compartmentalized applications.

(2)Databases, in the context of a website, are the brains that make websites

dynamic. Any time you request something from a website—whether you’re searching

for a product in an online store or searching for hotel locations within a

specific state—the database is responsible for accepting that query, fetching

the data, and returning it to the website. Databases can also accept new and

edited data when users of a website or application interact with them. The

client can change information in a database from the browser, whether a user is

posting articles to a CMS, uploading photos to a social media profile, or

updating their customer information.

In this quick Guide to Modern Database Technology, you’ll get an understanding

of how databases work, common terms to know, a look at SQL vs. NoSQL, and how

to determine which database is best for your web application.

(3)Middleware essentially describes any software on the server that connects an

application’s front end to its back end. Think of middleware as plumbing for

your site—it pipes any communication, like requests and responses, back and

forth between your application and your server/database. Just like plumbing in

a house, you don’t see middleware, but it’s there and it has to be reliable and

always do what’s expected of it.

Middleware (server-side software) facilitates client-server connectivity,

forming a middle layer between the app(s) and the network: the server, the

database, the operating system, and more. Middleware can be multi-layered,

organized into different layers of a site, whether it’s the presentation layer

or the business layer. This is also where Web APIs can play into the stack,

providing a bridge between the business layer and presentation layer.

Middleware also lets cloud applications and on-premise applications “talk,” and

provides services like data integration and error handling. Good middleware can

also maximize IT efficiency and power things like user engagement, business

process management, content management, authentication, and more. Koa.js is an

example of a server-side JavaScript framework.

Next, we’ll talk about some of the programming languages and frameworks used to

build different types of middleware, APIs, and server-side software.

(4)You can’t talk about the back-end portion of an application these days with

-out touching on APIs (application programming interfaces) and how they connect

software, applications, databases, and services together seamlessly. APIs play

an integral role in how most server-side software architectures are built,

oftentimes replacing more complicated programming to allow software to communi

-cate and data to be transferred.

To help explain the power of APIs, Upwork wrote the free ebook “The API Economy”

that covers all you need to know to get started with APIs. Download it for free.

"Common skills needed for back end development"

5.Common skills needed for back end development

Now that you know what back-end development involves, let’s distill these concepts into a list of skills a back-end developer should possess.

(1)Basic understanding of front-end technologies HTML, JavaScript, and CSS

(2)Working knowledge of back-end development (configuration, administration and management of databases and servers)

(3)Server-side languages (e.g., PHP, C#, Java)

(4)Database technologies (e.g., MySQL and SQL)

(5)Security and authentication best practices

(6)Experience writing RESTful APIs

6.Common back-end development jobs

Back-end development is an umbrella term that refers to the server-side of any

application (not just websites). The fundamentals of understanding how to build

the back-end of an application can thus be applied to a number of different

professions. Let’s took at the most common back-end development roles:

(1)Back-end web developers: The most common job for back-end developers is to

build the back end of a website. They are responsible for building and

maintaining the database, server, and business logic behind a website.

(2)Full-stack developers: Full-stack developers have a working knowledge of 

both the front-end and back-end of a technology stack. On small projects 

they may be the sole developer building a minimum viable product. On larger

projects they are team leaders assisting with integration between the front

and back end of an app.

(3)Java developers: From websites to desktop applications, back-end developers

who specialize in Java are in high-demand in the enterprise app industry.

(4)Software developers: Depending on the job description, this could be another

Java developer job or any of the other languages we listed above. Software

development roles usually refer to non-website applications such as desktop apps. 

7.Hiring a back-end developer

You may know you need some back-end development and engineering, but may not

know what goes into your project or which experts you’ll need to get it done.

When it comes time to find that top-notch back-end developer, we’ve put

together a few more resources for you.

If you have settled on a stack or technology, Upwork’s Hiring Guides have

articles to help you find, hire, budget for, and write job descriptions for

a variety of developers like PHP developers, SQL developers, C# developers,

and .NET developers.

Once you’ve created your job post, kick off your search for top talent to

invite to your project. Upwork has smart filters that let you drill down into

the skills and categories you need. Or, search reviews of engineering and

architecture professionals and filter for ratings and location. These

reliable, first-hand reviews help connect you to talent who have had success

with projects like yours.

8.Others

Is PHP front or back end

PHP belongs to the LAMP stack, which stands for Linux, Apache, MySQL, and PHP/

Perl/Python.

To develop a web app with this technology stack, a software engineer needs to

know four different syntax systems, as well as HTML and CSS.

9.Refer

https://www.upwork.com/resources/beginners-guide-back-end-development

Software Engineer Tools Conclusions

I need to conclude software engineering tools about what are they and how to use

those.

1. Commands Or Plug-ins

1.1 Sync Data

If Syncing data use sharing folder, virtual machine could access Host machine's

folders.

Also, we could install samba(Server Message Block, about 79MB) on Linux via

sudo apt install samba, and transmit data full duplex between Host machine

and Linux.

If Syncing data use the setting of image folder or the creation of sharing

internet, the host machine could access the virtual machine's folders.

This we talk about the second syncing data.

The below sync data is that Host machine access the Linux under virtual machine

.

Data between Linux(Virtual Machine) and MacOS/Window(Host Machine); Or,

data between Linux(Remote/Cloud Machine) and MacOS/Window(LocalMachine); Or,

data between Linux(Docker) and MacOS/Window(Host Machine).

refer:

Setting up SSH access to virtual machines

(#+VirtualBox+Linux+NAT+SSH+Remote)Easy way to SSH into VirtualBox machine | Any OS

(#+VirtualBox+Linux+NAT+SSH+Local)How to access a NAT guest from host with VirtualBox

VirtualBox Host ssh to Guest

Enable or Disable Automatic Login in Debian 11 Bullseye

The System Network Configuration of Debian 101(Chinese Blog)

The Network Configuration of Ubuntu Under Macbook's VirtualBox(Chinese Blog)

(Windows+VMware+CentOS+NAT+Remote)How to access the Web services under virtual machine(Chinese Blog)

(Mac+Unknown+ubuntu+Bridge+SSH+Local/Cloud)Mac using SSH access VM ubuntu and cloud 's operation(Chinese Blog)

(Mac+VirtualBox+Linux(Kail)+SSH+Local)MacBook using SSH connect With Virtual machine Kail and set auto-log once Kail start(Chinese Blog)

(Mac+Parallels+Fedora+NAT+SSH+Local)Mac terminal using SSH connect Parallels VM Linux(Chinese Blog)

END refer!

First, we need to find out the IP address.

Find Public IP on Linux/MacOS:

curl ifconfig.me;

curl ipinfo.io/ip;

curl api.ipify.org;

curl checkip.dyndns.org;

curl ident.me;

curl ipecho.net/plain.

Find Mac IP:

(Local IP)

(wired connections): ipconfig getifaddr en1;

(Wi-Fi): ipconfig getifaddr en0 or ifconfig | grep inet;

Find Linux IP:

(Local/Private/Internal IP)

hostname -I;

hostname -I | awk '{print $1}';

ip route get 1.2.3.4 | awk '{print $7}';

ip a;

ifconfig | grep inet

nmcli -p device show.

ip addr This will return the address in either the Ethernet (ether) or

wireless (link) information, depending on how the device is connected to the

network. And this command will display the IPv4 and IPv6 addresses of all of

the network-connected devices. The IP address you need can be found under one

of the following labels: UP, BROADCAST, RUNNING, MULTICAST.

1.1.1 rsync(Shell command)

Transform/Transmit and sync the data/code between local and remote.

1.2 spell check(command)

1.2.1 Vim

VSCode just use Extension Code Spell Checker and Grammarly (unoffical).

vim for writers.

Config spell in Vim under /usr/share/vim/vim81/spell.

Need to type the command inside Vim session.

:help spell: know more about spell check feature.

:set spell : enable spell check.

:set nospell : disable spell check.

]s : find the misspelled word after the cursor (forward search).

[s : find the misspelled word before the cursor (backward search).

]S : (note the capital "S") - Similar to "]s" but only stop at bad words,

not at rare words or words for another region.

[S : similar to "[s" but search backwards.

z= : find suggestions for the that particular word (then type number XXX and

ENTER replace that misspelled word).

:wq : save the changes and quit Vim editor.

:set spell spelllang=en_us : set spell language to US English.

(Terminal session) $ mkdir -p ~/.vim/spell/ and

:set spellfile=~/.vim/spell/en.utf-8.add : enable add words to spellfile.

either [s or ]s and type zg. It will add the word under the cursor as good word

in spellfile.

zug : undo this add (remove the word from spellfile).

zw : mark the mispelled word.

zuw : undo this action.

:help spelllang : checkout spell language.

:help spellfile : checkout added spell file.

:help spellfile-cleanup.

Related Read:

1.How To Manage Vim Plugins Using Vundle On Linux.

2.GNU Aspell – A Free, Open Source And Independent Spell Checker.

1.3 Syntax highlighting(command)

1.3.1 Vim

Syntax highlighting is on for vim editor by default.

After opening target file in vim editor, press ESC key and type :syntax on

to enable syntax highlighting.

Press ESC key and type, syntax off to disable syntax highlighting.

1.4 Auto-complete(command)

1.4.1 oh-my-zsh(Shell)

Auto list the directories: input cd and type tab key, use tab switch.

AUto complete simplified directory: access /usr/local/bin, input cd /u/l/b

and type tab to auto complete.

Auto check camel case and correct: access Desktop, input cd de and type

tab to correct case; Or, check README.md, input cat re and type tab to

auto complete and correct.

Auto complete command: check using command, inputkubectl and type tab to

check useable command.

Auto complete command parameter: input kill and type tab to auto display

running process ID.

Refer: Using oh-my-zsh build Linux Shell environment(Chinese).

2. Applications

3. Online Services

4. Framework Or Libraries

5.Know About

CLion (pronounced "sea lion") is a C and C++ IDE for Linux, macOS, and Windows

integrated with the CMake build system. The initial version supports GNU

Compiler Collection (GCC) and Clang compilers and GDB debugger, LLDB and Google

Test.

JetBrains, initially called IntelliJ Software, makes tools for software

developers and project managers.

Blaze, only by google using, a tool to automate software building and testing.

Blaze includes the description of source dependence, distributed building,

test. Also, well Integrated with the management system of source, auto-deploy, continuous integrated system.

5.4Bazel

Bazel is a free software tool for the automation of building and testing of

software. The company Google uses the build tool Blaze internally and released

an open-sourced port of the Blaze tool as Bazel, named as an anagram of Blaze.

Similar to build tools like Make, Apache Ant, or Apache Maven, Bazel builds

software applications from source code using a set of rules. Rules and macros

are created in the Starlark language, a dialect of Python. There are built-in

rules for building software written in the programming languages of Java, C,

C++, Go, Python, Objective-C and Bourne shell scripts.

Blade is a building system from Tencent, supports many mainstream programming

languages, such as C/C++, java, scala, python, protobuf.

5.6Buck

Buck is a build system developed and used by Facebook. It encourages the

creation of small, reusable modules consisting of code and resources, and

supports a variety of languages on many platforms.

Atom was (and is) developed by GitHub as a text editor. Facebook then developed

the Nuclide and Atom IDE projects to turn Atom into an integrated

development environment (IDE), but development on Nuclide and Atom IDE stopped

in December 2018. Development on Atom itself is ongoing.

Nuclide is built as a single package on top of Atom to provide hackability

and the support of an active community. It provides a first-class development

environment for React Native, Hack and Flow projects.

Debian AMD64 ISO

PHP5.X is friendly with Debian 7/8, Ubuntu 12/14.

Debian 8.8.0 amd64 DVD iso download address:

(1)mirror.thehost.com.ua

(2)ftp.cae.tntech.edu

Debian 8.0.0 DVD iso download address:

(1)archive.org

Debian 8.5.0 DVD iso download address:

(1)mirror.deterlab.net

(2)archive.org

(3)www.pcds.fi

Debian 8.10.0 DVD iso download address:

(1)cdimage.debian.org

Refer:

(1)Install Debian9.X server.(Chinese)

(2)Install DebianOS under VM(Chinese)

(3)Installing Debian Linux on your Mac using Parallels Desktop

Problem Happens that Debian On Mac Via Parallels

1. Problem A

1.1 Output

Debian requires Authentication.

1.2 Why

We do not enable root user.

1.3 Standard Operating Procedure

Enter terminal and input:

sudo passwd

And terminal output:

Password(you user password):your_current_user_password

As the upstairs terminal shows, and input your current user password. And output

Enter new UNIX password:your_new_root_password

retype new UNIX password: again_your_new_root_password

As the upstairs terminal shows, input twice your new root password.

1.4 Refer

The default root and password during installing centos7 at Parallels Desktop(Chinese Blog).

2. Problem B

2.1 Question

I need to change the host name of Debian in the virtual machine at mac.

2.2 Standard Operating Procedure

Input below code at your terminal:

hostnamectl hostname your_new_host_name

your_new_host_name is the target host name of Linux.

3. Problem C

Enter or logout the root mode.

3.1 Standard Operating Procedure

login root mode, input the below code and type "enter" key, then type your

root password:

su -

exit the root mode, just type the code:

exit

Or

logout

Or

Ctrl+D

the upstairs are typing keys.

4. Problem D

Checkout the target software version.

all the source: apt-cache madison vim;

all source policy: apt-cache policy vim;

all version, reverse depends, dependencies, provides, reverse provides:

apt-cache showpkg vim.

5. Problem E

make error output:

/bin/sh: 1: git: not found

...

GITGUI_VERSION = 0.21.GITGUI

* new locations or Tcl/Tk interpreter

GEN git-gui

INDEX lib/

* tclsh failed; using unoptimized loading

MSGFMT    po/de.msg Makefile:252: recipe for target 'po/de.msg' failed

make[1]: ***[po/de.msg] Error 127

Makefile:1955: recipe for target 'all' failed

make:*** [all] Error 2

Fix upstairs error:

sudo apt install tcl build-essential tk

And the output:

SUBDIR templates

MSGFMT po/build/locale/pt_PT/LC_MESSAGES/git.mo

/bin/sh: 1: msgfmt: not found

Makefile:2449: recipe for target 'po/build/locale/pt_PT/LC_MESSAGES/git.mo' failed

make: *** [po/build/locale/pt_PT/LC_MESSAGES/git.mo] Error 127

Again fix upstairs error:

sudo apt install gettext-devel

Again the output:

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package gettext-devel

Again again fix upstairs error:

sudo apt-get install gettext

And fixed.

6. Problem F

copy and paste text in Linux.

copy:

Shift+Ctrl+C

paste:

Shift+Ctrl+V

But, I've just used hotkeys map between MacOS and virtual machine Debian.

apt-get update W:

W: There is no public key available for the following key IDs:

AA8E81B4331F7F50

Fixed:

sudo apt-get install debian-keyring debian-archive-keyring

sudo apt-key update

sudo apt-get update

My Code Checklist

1. Wrong spelling

(1) eperate -> separate

(2) seperated -> separated

(3) seperating -> separating

(4) contianer -> container

(5) iamge -> image

(6) funncy -> fancy

(7) developent -> development

(8) creat -> create

(9) wintness -> witness

(10) lamda -> lambda

(11) cruial -> crucial

(12) enviroemnt -> environment

(13) environmnet -> environment

(14) Jebain -> Jetbrain

(15) Clion -> CLion

(16) prinf -> printf

(17) systlog -> syslog

(18) everytime -> every time

(19) initalized -> initialized

(20) grammer -> grammar

(21) recompileing -> recompiling

(22) editting-> editing

(23) orgnization -> organization

(24) formater -> format

(25) contian -> contain

(26) Lamda -> Lambda

(27) Debain -> Debian

(28) Happans -> Happens

(29) Bebian -> Debian

(30) requies -> requires

(31) Authenication -> Authentication

(32) Ctrol -> Ctrl

(33) Modefy -> Modify

(34) simpified -> simplified

(35) correcte -> correct

(36) intergrate -> integrate

Shell Command Manual ABC

1. Check Default Shell

echo $SHELL

2. Linux Download Tools

Debian(Ubuntu): apt, apt-get;

Fedora: dnf;

CentOS: yum;

3. Check Java Version

java -version

4. Check dependence

macOS:

brew deps xxx -tree

5. Grep

To find out "python":

ls -l | grep "python"

6. Upgrade

Debian To upgrade all the latest version:

sudo apt update && sudo apt upgrade

7. Search

To search package on macOS/Debian:

macOS:

brew search package

Debian:

apt search package

apt-cache madison package

8. Exit Ping

macOS/Linux: Ctrl + c.

Text Editor

1.Vim

Simple navigation.

2.Nano

A legitimately reverent appreciation for Nano's intuitive interface.

Save and exit a file using nano editor:

1.To exit and save the file, start by pressing Ctrl + X on your keyboard.

This will attempt to exit nano. To remember this keyboard combination, check

the bottom of the nano menu. ^X just means Ctrl + X.

2.You’ll now be asked if you want to save your changes to the file. You need to

respond by entering either “Y” or “N”. Since we are trying to save our changes,

press “Y” and hit enter.

3.Next, you’ll be asked to give a name to the file. If you’re trying to

overwrite an existing file with your current changes, then you can simply hit

enter on your keyboard. Otherwise, fill out a new file name.

3.Emacs

Yet to find anything lacking in GNU Emacs.

Ctrl+X and Ctrl+C save and exit file.

4.Refer

Vim vs. Nano vs. Emacs: Three sysadmins weigh in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment