mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
20150413-3 选题
This commit is contained in:
parent
67930257ba
commit
55a35270b7
@ -0,0 +1,105 @@
|
||||
A Walk Through Some Important Docker Commands
|
||||
================================================================================
|
||||
Hi everyone today we'll learn some important Docker Commands that you'll need to learn before you go with Docker. Docker is an Open Source project that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider.
|
||||
|
||||
Docker commands are easy to learn and easy to implement or take into practice. Here are some easy Docker commands you'll need to know to run Docker and fully utilize it.
|
||||
|
||||
### 1. Pulling a Docker Image ###
|
||||
|
||||
First of all, we'll need to pull a docker image to get started cause containers are built using Docker Images. We can get the required docker image from the Docker Registry Hub. Before we pull any image using pull command, we'll need to protect our system as there is identified a malicious issue with pull command. To protect our system from this issue, we'll need to add **127.0.0.1 index.docker.io** into /etc/hosts entry. We can do using our favorite text editor.
|
||||
|
||||
# nano /etc/hosts
|
||||
|
||||
Now, add the following lines into it and then save and exit.
|
||||
|
||||
127.0.0.1 index.docker.io
|
||||
|
||||
![Docker Hosts](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-hosts.png)
|
||||
|
||||
To pull a docker image, we'll need to run the following command.
|
||||
|
||||
# docker pull registry.hub.docker.com/busybox
|
||||
|
||||
![Docker pull command](http://blog.linoxide.com/wp-content/uploads/2015/04/pulling-image.png)
|
||||
|
||||
We can check whether any Docker image is available in our local host for the use or not.
|
||||
|
||||
# docker images
|
||||
|
||||
![Docker Images](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-images.png)
|
||||
|
||||
### 2. Running a Docker Container ###
|
||||
|
||||
Now, after we have successfully pulled a required or desired Docker image. We'll surely want to run that Docker image. We can run a docker container out of the image using docker run command. We have several options and flags to run a docker container on the top of the Docker image. To run a docker image and to get into the container we'll use -t and -i flag as shown below.
|
||||
|
||||
# docker run -it busybox
|
||||
|
||||
![Docker Run Shell Command](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-run-shell.png)
|
||||
|
||||
From the above command, we'll get entered into the container and can access its content via the interactive shell. We can press **Ctrl-D** in order to exit from the shell access.
|
||||
|
||||
Now, to run the container in background, we'll detach the shell using -d flag as shown below.
|
||||
|
||||
# docker run -itd busybox
|
||||
|
||||
![Run Container Background](http://blog.linoxide.com/wp-content/uploads/2015/04/run-container-background.png)
|
||||
|
||||
If we want to attach into a running container, we can use attach command with the container id. The container id can be fetched using the command **docker ps** .
|
||||
|
||||
# docker attach <container id>
|
||||
|
||||
![Docker Attach](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-attach.png)
|
||||
|
||||
### 3. Checking Containers ###
|
||||
|
||||
It is very easy to check the log whether the container is running or not. We can use the following command to check whether there is any docker container running in the real time or not using the following command.
|
||||
|
||||
# docker ps
|
||||
|
||||
Now, to check logs about the running or past running containers we'll need to run the following command.
|
||||
|
||||
# docker ps -a
|
||||
|
||||
![View Docker Containers](http://blog.linoxide.com/wp-content/uploads/2015/04/view-docker-containers1.png)
|
||||
|
||||
### 4. Inspecting a Docker Container ###
|
||||
|
||||
We can check every information about a Docker Container using the inspect command.
|
||||
|
||||
# docker inspect <container id>
|
||||
|
||||
![Docker Inspect](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-inspect.png)
|
||||
|
||||
### 5. Killing and Deleting Command ###
|
||||
|
||||
We can kill or stop process or docker containers using its docker id as shown below.
|
||||
|
||||
# docker stop <container id>
|
||||
|
||||
To stop every containers running, we'll need to run the following command.
|
||||
|
||||
# docker kill $(docker ps -q)
|
||||
|
||||
Now, if we wanna remove a docker image, run the below command.
|
||||
|
||||
# docker rm <container id>
|
||||
|
||||
If we wanna remove all the docker images at once, we can run the below.
|
||||
|
||||
# docker rm $(docker ps -aq)
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
These docker commands are highly essential to learn to fully utilize and use Docker. Docker gets too simple with these commands providing end users an easy platform for computing. It is extremely easy for anyone to learn about Docker commands with this above tutorial. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve and update our contents. Thank you ! Enjoy :-)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-how-to/important-docker-commands/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
@ -0,0 +1,144 @@
|
||||
Elementary OS 0.3 Freya Screenshots - Download and Install Guide
|
||||
================================================================================
|
||||
Elementary OS is a light weight Ubuntu based operating system which is getting wide spread popularity. It has three versions released to date whereas fourth version is decided to be developed based on upcoming Ubuntu 16.04.
|
||||
|
||||
- **Jupiter (0.1)**: It was the first stable version of Elementary OS based on Ubuntu 10.10 and released on March 2011.
|
||||
- **Luna (0.2)**: Second stable version of Elementary OS based on Ubuntu 12.04 and released on November 2012.
|
||||
- **Freya (0.3)**: Third stable version of Elementary OS based on Ubuntu 14.04 and released on 8th February 2015.
|
||||
- **Loki (0.4)**: Fourth upcoming version of Elementary OS is planned to be based on Ubuntu 16.04 it will get updates till 2021.
|
||||
|
||||
Freya is the latest version (0.3) of Elementary OS available now, initially it was given the name ISIS but it was later changed to avoid any sort of association with a terrorist group named alike. Freya has some very nice preloaded applications.
|
||||
|
||||
### Salient Features ###
|
||||
|
||||
Here are some but not all of the features of Elementary OS 0.3.
|
||||
|
||||
- Better interactive notifications along with notification setting pane including a system-wide “Do Not Disturb” mode
|
||||
- Latest version of Elementary OS provides a better emoji support & drop-in replacements for Microsoft Core fonts for the web applications
|
||||
- Privacy Mode is a new firewall tool which is easy to use and helps protect the computer from harmful scripts and applications
|
||||
- Unified login and lock screens
|
||||
- Applications menu with and improved look and functionality including quicklist actions, drag-and-drop from search, and support for quick math calculations
|
||||
- Multitasking view is redesigned to provide more app-focused utility
|
||||
- Updated software stack (Linux 3.16, Gtk 3.14, and Vala 0.26) for better support and enhanced functionality of latest developed applications
|
||||
- Unified extensible firmware interface (UEFI) support
|
||||
- WiFi connectivity made easier through new captive portal assistant
|
||||
|
||||
### Download 64 bit & 32 bit Version ###
|
||||
|
||||
- [Elementary OS Freya 64 bit][1]
|
||||
- [Elementary OS Freya 32 bit][2]
|
||||
|
||||
### Installing Elementary OS 0.3 (Freya) ###
|
||||
|
||||
Download the ISO file of Elementary OS 0.3 and flash it on a bootable USB drive or to a DVD/CD. Source is available for both 32-bit and 64-bit architectures. Once the computer is booted with the Elementary OS ISO file, there are two options available, either to try without installing or install Elementary OS on the computer, choose the second option. Elementary OS can also be installed along with an already installed operating system, turning it into a dual boot machine.
|
||||
|
||||
![Install Freya](http://blog.linoxide.com/wp-content/uploads/2015/04/Install-Freya.png)
|
||||
|
||||
System requirements and available resources are checked before proceeding further. Click continue if your system has enough resources.
|
||||
|
||||
![Installation Requirements](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Requirements.png)
|
||||
|
||||
Installation wizard then provides various installation types. Opt for the option best suits you, normally, first option is chosen by most i.e. “Erase disk and install Elementary”. With this option make sure that your data is backed up properly because the disk (partition) will be erased and all data will be lost.
|
||||
|
||||
![Installation Types](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Types.png)
|
||||
|
||||
A dialog box shows the list of disk partitions being formatted and used by the Elementary OS, after ensuring data integrity click continue.
|
||||
|
||||
![Format Warning](http://blog.linoxide.com/wp-content/uploads/2015/04/Format-Warning.png)
|
||||
|
||||
Choose your location for time zone selection and click continue.
|
||||
|
||||
![Location](http://blog.linoxide.com/wp-content/uploads/2015/04/Location.png)
|
||||
|
||||
Choose your language and click continue.
|
||||
|
||||
![Language](http://blog.linoxide.com/wp-content/uploads/2015/04/Language.png)
|
||||
|
||||
Fill in your information and choose a strong root/administrator password and click continue.
|
||||
|
||||
![whoareyou](http://blog.linoxide.com/wp-content/uploads/2015/04/whoareyou.png)
|
||||
|
||||
Core installation process starts once the personal information is provided, details of components being installed will be flashing on a little dialogue box along with the progress bar.
|
||||
|
||||
![Installation progress](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-progress.png)
|
||||
|
||||
Congratulation! Installation is complete for your latest Elementary OS 0.3 (Freya). A restart is required to update and finalize registries and configurations.
|
||||
|
||||
![Installation Complet](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Complet.png)
|
||||
|
||||
At start up the Elementary OS logo shows its elegance and then password protected administrator login and guest session options will appear. Guest section has pretty limited features and has no installation privileges.
|
||||
|
||||
![Login](http://blog.linoxide.com/wp-content/uploads/2015/04/Login.png)
|
||||
|
||||
Here is the first look of the newly installed Elementary OS 0.3.
|
||||
|
||||
![first look](http://blog.linoxide.com/wp-content/uploads/2015/04/first-look.png)
|
||||
|
||||
### Customizing Desktop ###
|
||||
|
||||
While Elementary OS 0.3 is best known for their light weight and better looks, everybody has a unique esthetic sense and computer usage habits. Desktop reflects a personalized view of any computer user. Like other operating systems Elementary OS 0.3 also provides various options to customize our desktop through wallpapers, font sizes, themes etc.
|
||||
|
||||
For basic customization, click on Applications > System Settings > Desktop
|
||||
|
||||
We can change wallpapers, dock and make use of hot corners of the desktop.
|
||||
|
||||
Very few wallpapers are provided by default, more can be downloaded from the internet or transferred to your own camera.
|
||||
|
||||
![Desktop Wallpaper](http://blog.linoxide.com/wp-content/uploads/2015/04/Desktop-Wallpaper4.png)
|
||||
|
||||
The real beauty of Elementary OS lies in its elegant Dock panel. With no icons allowed at desktop, a set of application icons at the dock panel enhance the look and provide a quick way to lunch frequently used applications.
|
||||
|
||||
![Desktop Dock](http://blog.linoxide.com/wp-content/uploads/2015/04/Desktop-Dock1.png)
|
||||
|
||||
Users can use the corners of the desktop for customary purposes.
|
||||
|
||||
![Hot Corners](http://blog.linoxide.com/wp-content/uploads/2015/04/Hot-Corners.png)
|
||||
|
||||
Advanced customization can be achieved through the installation of elementary tweaks.
|
||||
|
||||
Add stable Personal Package Archive (PPA) to Advanced Package Tool (APT) repository using the following command.
|
||||
|
||||
sudo add-apt-repository ppa:mpstark/elementary-tweaks-daily
|
||||
|
||||
![ppa](http://blog.linoxide.com/wp-content/uploads/2015/04/elementary-tweaks-ppa.png)
|
||||
|
||||
Once the package has been added to the repository we need to update the repository using following command
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
![update repository](http://blog.linoxide.com/wp-content/uploads/2015/04/update-repository.png)
|
||||
|
||||
After updating the repository we are ready to install inkscape which is accomplished using the following command
|
||||
|
||||
sudo apt-get install elementary-tweaks
|
||||
|
||||
![install elementary tweaks](http://blog.linoxide.com/wp-content/uploads/2015/04/install-elementary-tweaks.png)
|
||||
|
||||
We can see an addition of Tweaks option under Applications > System Settings under the Personal section. It now provides us more options to customize our desktop view.
|
||||
|
||||
![tweaks](http://blog.linoxide.com/wp-content/uploads/2015/04/tweaks.png)
|
||||
|
||||
For further customizations we also install gnome tweak tool for example unlocking the desktop.
|
||||
|
||||
sudo apt-get install gnome-tweak-tool
|
||||
|
||||
![gnome](http://blog.linoxide.com/wp-content/uploads/2015/04/gnome.png)
|
||||
|
||||
### Summary ###
|
||||
|
||||
Elementary OS is closely related to Ubuntu distro of Linux and its pros and cons are pretty much similar too. Elementary OS is lightweight, elegant in look and feel, rapidly maturing. It is potentially an alternative for both Windows and OS X operating systems. The latest available Elementary OS 0.3 (Freya) is getting very popular with a better feature base. For further reading, latest updates and downloads please visit the official [website][1].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/ubuntu-how-to/elementary-os-0-3-freya-install-guide/
|
||||
|
||||
作者:[Aun Raza][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunrz/
|
||||
[1]:http://sourceforge.net/projects/elementaryos/files/stable/elementaryos-freya-amd64.20150411.iso/download
|
||||
[2]:http://sourceforge.net/projects/elementaryos/files/stable/elementaryos-freya-i386.20150411.iso/download
|
||||
[3]:http://elementary.io/
|
@ -0,0 +1,174 @@
|
||||
How to Show Dialog Box from Bash Shell Script with Examples
|
||||
================================================================================
|
||||
This tutorial will give couple of examples on how to use utilities like zenity and whiptail in your Bash shell script to provide message / dialog box . With these utilities your script will be able to inform user about the current state of execution, or give an ability to interact. Difference between these two utilities is the way they are displaying message box or dialog. Zenity uses GTK toolkit for creating graphical user interfaces, while whiptail creates message boxes inside terminal window.
|
||||
|
||||
### Zenity Tool ###
|
||||
|
||||
To install zenity on Ubuntu run:
|
||||
|
||||
sudo apt-get install zenity
|
||||
|
||||
Since commands for creating message boxes or dialogs with zenity are pretty self explanatory, we will provide you with couple of examples.
|
||||
|
||||
### Creating information box ###
|
||||
|
||||
zenity --info --title "Information Box" --text "This should be information" --width=300 --height=200
|
||||
|
||||
![Screenshot-Information Box](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Information-Box.png)
|
||||
|
||||
Creating Yes/No dialog
|
||||
|
||||
zenity --question --text "Do you want this?" --ok-label "Yeah" --cancel-label="Nope"
|
||||
|
||||
![Screenshot-Question](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Question.png)
|
||||
|
||||
Creating entry box and storing value in variable
|
||||
|
||||
a=$(zenity --entry --title "Entry box" --text "Please enter the value" --width=300 --height=200)
|
||||
echo $a
|
||||
|
||||
![Screenshot-Entry box](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Entry-box.png)
|
||||
|
||||
After entering it, value will be stored in $a variable.
|
||||
|
||||
Here is the working example which takes user's first name, last name and age and displays it.
|
||||
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script will ask for couple of parameters
|
||||
# and then continue to work depending on entered values
|
||||
#
|
||||
|
||||
# Giving the option to user
|
||||
zenity --question --text "Do you want to continue?"
|
||||
|
||||
# Checking if user wants to proceed
|
||||
[ $? -eq 0 ] || exit 1
|
||||
|
||||
# Letting user input some values
|
||||
FIRSTNAME=$(zenity --entry --title "Entry box" --text "Please, enter your first name." --width=300 --height=150)
|
||||
LASTNAME=$(zenity --entry --title "Entry box" --text "Please, enter your last name." --width=300 --height=150)
|
||||
AGE=$(zenity --entry --title "Entry box" --text "Please, enter your age." --width=300 --height=150)
|
||||
|
||||
# Displaying entered values in information box
|
||||
zenity --info --title "Information" --text "You are ${FIRSTNAME} ${LASTNAME} and you are ${AGE}(s) old." --width=300 --height=100
|
||||
|
||||
Here are the screenshots of previous script.
|
||||
|
||||
![Example1-Question-1](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Question-1.png)
|
||||
|
||||
First box
|
||||
|
||||
![Example1-Entry box-1](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-1.png)
|
||||
|
||||
Entry box
|
||||
|
||||
![Example1-Entry box-2](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-2.png)
|
||||
|
||||
Entry box
|
||||
|
||||
![Example1-Entry box-3](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-3.png)
|
||||
|
||||
Entry box
|
||||
|
||||
![Example1-Information](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Information.png)
|
||||
|
||||
Information box
|
||||
|
||||
Don't forget refer some of the useful [zenity options][1] that might help you.
|
||||
|
||||
### Whiptail Tool ###
|
||||
|
||||
To install whiptail on Ubuntu run
|
||||
|
||||
sudo apt-get install whiptail
|
||||
|
||||
Commands for creating message box/dialog with whiptail are also self explanatory, so we will provide you with just couple of basic examples.
|
||||
|
||||
### Creating message box ###
|
||||
|
||||
whiptail --msgbox "This is a message" 10 40
|
||||
|
||||
![Screenshot-whiptail-msgbox](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-msgbox.png)
|
||||
|
||||
### Creating Yes/No dialog ###
|
||||
|
||||
whiptail --yes-button "Yeah" --no-button "Nope" --title "Choose the answer" --yesno "Will you choose yes?" 10 30
|
||||
|
||||
![Screenshot-whiptail-yesno](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-yesno.png)
|
||||
|
||||
### Creating entry box with default value ###
|
||||
|
||||
whiptail --inputbox "Enter your number please." 10 30 "10"
|
||||
|
||||
![Screenshot-whiptail-entry](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-entry.png)
|
||||
|
||||
One thing to be aware of when trying to use entered value is that whiptail uses stdout for displaying dialog, and stderr for value output. That way, if you use var=$(...) you wont see dialog box at all, and wont get the entered value. Solution is to switch stdout and stderr. To do that just add **3>&1 1>&2 2>&3** at the end of the whiptail command. Same would be with any whiptail command which you want to use to get some entered value.
|
||||
|
||||
### Creating menu dialog ###
|
||||
|
||||
whiptail --menu "This is a menu. Choose an option:" 20 50 10 1 "first" 2 "second" 3 "third"
|
||||
|
||||
![Screenshot-whiptail-menu](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-menu.png)
|
||||
|
||||
Here is a **shell script** that asks user to enter a path to a folder and then outputs it's size.
|
||||
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
|
||||
# Since whiptail has to use stdout to display dialog, entered value will
|
||||
# be stored in stderr. To switch them and get the value to stdout you must
|
||||
# use 3>&1 1>&2 2>&3
|
||||
FOLDER_PATH=$(whiptail --title "Get the size of folder" \
|
||||
--inputbox "Enter folder path:" \
|
||||
10 30 \
|
||||
"/home" \
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
if [ -d $FOLDER_PATH ]
|
||||
then
|
||||
size=$(du -hs "$FOLDER_PATH" | awk '{print $1}')
|
||||
whiptail --title "Information" \
|
||||
--msgbox "Size of ${FOLDER_PATH} is ${size}" \
|
||||
10 40
|
||||
elif [ -f $FOLDER_PATH ]
|
||||
then
|
||||
whiptail --title "Warning!!!" \
|
||||
--msgbox "The path you entered is a path to a file not a folder!" \
|
||||
10 40
|
||||
else
|
||||
whiptail --title "Error!!!"
|
||||
--msgbox "Path you entered is not recognized. Please try again" \
|
||||
10 40
|
||||
fi
|
||||
|
||||
Here are the screenshots from previous example:
|
||||
|
||||
![Example2-Entry-box](http://blog.linoxide.com/wp-content/uploads/2015/03/Example2-Entry-box.png)
|
||||
|
||||
Entry box
|
||||
|
||||
![Example2-Information](http://blog.linoxide.com/wp-content/uploads/2015/03/Example2-Information.png\)
|
||||
|
||||
Information box
|
||||
|
||||
If you are working in terminal , [manual pages][2] are always available.
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
Choosing the right tool for displaying dialogs will depend on whether you expect your script to be run on desktop machine or server machine. Desktop machine users mostly use window environment and will possibly be able to run the script and interact with appearing windows. However, if you are expecting that the user is someone on server machine, you might want to play it safe and use whiptail or any other utility that will display dialogs in plain terminal window.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-shell-script/bash-shell-script-show-dialog-box/
|
||||
|
||||
作者:[Ilija Lazarevic][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/ilijala/
|
||||
[1]:https://help.gnome.org/users/zenity/stable/
|
||||
[2]:http://linux.die.net/man/1/whiptail
|
Loading…
Reference in New Issue
Block a user