mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
331b172e9e
@ -0,0 +1,102 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why I use open source technology for web development)
|
||||
[#]: via: (https://opensource.com/article/20/4/open-source-web-development)
|
||||
[#]: author: (Jimmy McArthur https://opensource.com/users/jimmymcarthur)
|
||||
|
||||
Why I use open source technology for web development
|
||||
======
|
||||
Micro-frontends with an API-driven approach power the OpenStack
|
||||
Foundation's platforms.
|
||||
![Text editor on a browser, in blue][1]
|
||||
|
||||
Every day, millions of people all over the world access the [OpenStack Foundation][2]'s (OSF) web properties to learn about open infrastructure. This level of usage requires a platform and toolsets that are fast, flexible, and affordable—and this is where open source comes in. Not only that, but given that we work for an open source software foundation, we naturally incorporate open source technologies into everything we do, including web development.
|
||||
|
||||
### Considerations for web development
|
||||
|
||||
When thinking about web development technologies, we must consider how we manage our software lifecycles. All software development includes some sort of [lifecycle management][3] with the opportunity to plan, analyze, design, and implement the code. Our web development team usually works on the fly, often under tight deadlines, and with other departments. That means our requirements and workflow must be flexible enough to allow for quick iterations, updates, and corrections. I'd rather push out something quickly and, if needed, go back in and make things pixel perfect after the fact.
|
||||
|
||||
Our team also has to consider all the stakeholders involved in the website, including our talented marketing teams who aren't familiar with Git workflows. That led us, like many others, to utilize a content management system (CMS), so those professionals can make updates without having to use Git.
|
||||
|
||||
### Building a CMS-agnostic web architecture
|
||||
|
||||
In order to uphold this need for flexibility, traditionally, we relied on an open source CMS, [SilverStripe][4]. However, our requirements quickly outgrew the system. So, we built a standalone API and use static micro-sites with [React][5] JavaScript components to pull data into custom-designed presentation layers. We use this system in everything from mobile apps to websites to digital signs. This has become known as a [Jamstack][6] architecture. We found this model was extensible enough that it allowed us to move our data anywhere while being CMS-agnostic.
|
||||
|
||||
When adopting this API-driven workflow, we realized that our data was used in many different places and presented in many different ways. Across our seven web properties, we share everything from graphics to dynamic content. A standard CMS won't do this without a lot of custom development work along with either cron jobs or costly database queries.
|
||||
|
||||
When things are API-driven, you can access all these different datasets across a variety of platforms while largely protecting your infrastructure from major traffic spikes. For example, the OSF collaborated with [Tipit][7], the OSF's digital design and development partner, to develop a completely open source end-to-end event management software. Our event-schedule data is presented on web pages, mobile apps, and digital signage. It's the same data, managed from a single place, but with different presentation layers, formats, and platforms.
|
||||
|
||||
### Open source identity access management
|
||||
|
||||
A cornerstone of moving to a decentralized Jamstack architecture is the need to establish identity and access rights. When using JavaScript to call for things in an API, we may need to require authentication and authorization. Therefore, we had to separate the identity provider from any individual implementation. There are two concepts to this: identity (authN) and identity access management (authZ). The identity provider confirms who you are, while access management confirms what roles and permissions you have to do different things. One of the first requirements when developing the event-management software was to establish a standalone identity provider.
|
||||
|
||||
Enter [OpenStackID][8], which is an [OpenID Connect][9] with oAuth2 SSO solution. OpenStackID started out as a more secure way for users to log into [Openstack.org][10] and manage their profiles. Even as the number of websites and event apps we manage grows, this creates a seamless authentication experience for users. The access-management portion allows us to build standalone React-based apps that use the identity provider to determine if a particular user has the rights to do the things they want to do in that specific application.
|
||||
|
||||
One thing that runs through everyone's mind—especially in a global open source community—is privacy. It's a large factor in creating our web and event properties. With OpenStackID, users can log into their [OpenStackID account][11] and set application permissions using the OAuth 2 console. If they decide they no longer want their app associated with their OpenStackID, they can simply remove permissions.
|
||||
|
||||
For example, we have users for our events that do not want their personal information to be associated with their presence at our conferences. The way the platforms are set up, all personally identifiable data is managed securely on the OpenID server, and it's not shared between applications unless the user strictly enables it. Beyond that, we never share things like the events a user attends or pieces of their user profile unless it's completely anonymized, or they specifically allow it in order to remain aligned with the [Four Opens][12] or our community philosophy.
|
||||
|
||||
### Better web infrastructure using open source
|
||||
|
||||
Taking our considerations and shifting toward a more flexible implementation of a CMS has helped our teams collaborate more effectively. Most importantly, we continue to follow our community values by providing great privacy and security options thanks to open source technology.
|
||||
|
||||
If you're interested in our approach, check out the OSF Foundation website's [source code][13]. You can also access the following source code repos to see the approach in action:
|
||||
|
||||
* [Zuul website][14]
|
||||
* [Airship website][15]
|
||||
* [StarlingX website][16]
|
||||
* [Kata Containers website][17]
|
||||
* [MOC and Open Infra Labs website][18]
|
||||
* [Open Stack Foundation website][19]
|
||||
* [Open Infrastructure Summit admin][20]
|
||||
* [Open Infrastructure Summit CFP][21]
|
||||
* [Open Infrastructure Summit Signage][22]
|
||||
* [OpenStack Survey GraphQL API to access survey data and reports][23]
|
||||
* [OpenStack Survey Graphene API to feed summit reports][24]
|
||||
* [OpenStackID authentication system][25]
|
||||
* [OpenStackID resource server][26]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/open-source-web-development
|
||||
|
||||
作者:[Jimmy McArthur][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jimmymcarthur
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue)
|
||||
[2]: https://osf.dev/
|
||||
[3]: https://en.wikipedia.org/wiki/Systems_development_life_cycle
|
||||
[4]: https://www.silverstripe.org/
|
||||
[5]: https://reactjs.org/
|
||||
[6]: https://jamstack.org/
|
||||
[7]: https://www.tipit.net/
|
||||
[8]: https://opendev.org/explore/repos?q=openstackid&tab=&sort=recentupdate
|
||||
[9]: https://openid.net/connect/
|
||||
[10]: http://Openstack.org
|
||||
[11]: https://openstackid.org/
|
||||
[12]: https://osf.dev/about/four-opens/
|
||||
[13]: https://github.com/OpenStackweb/openstack-org
|
||||
[14]: https://opendev.org/zuul/zuul-website
|
||||
[15]: https://github.com/AirshipWeb/airship-website
|
||||
[16]: https://github.com/StarlingXWeb/starlingx-website
|
||||
[17]: https://github.com/kata-containers/www.katacontainers.io
|
||||
[18]: https://github.com/OpenStackweb/openinfralabs-website
|
||||
[19]: https://github.com/OpenStackweb/osf-website
|
||||
[20]: https://github.com/OpenStackweb/summit-admin
|
||||
[21]: https://github.com/OpenStackweb/call-for-presentations
|
||||
[22]: https://github.com/OpenStackweb/openstacksignage
|
||||
[23]: https://github.com/OpenStackweb/openstack-survey-api
|
||||
[24]: https://github.com/OpenStackweb/summit-reports-api
|
||||
[25]: https://opendev.org/osf/openstackid
|
||||
[26]: https://opendev.org/osf/openstackid-resources
|
@ -1,159 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to install Python on Linux)
|
||||
[#]: via: (https://opensource.com/article/20/4/install-python-linux)
|
||||
[#]: author: (Vijay Singh Khatri https://opensource.com/users/vijaytechnicalauthor)
|
||||
|
||||
How to install Python on Linux
|
||||
======
|
||||
Step-by-step instructions for installing the latest Python instead of
|
||||
(or alongside) an older version on Linux.
|
||||
![OpenStack source code \(Python\) in VIM][1]
|
||||
|
||||
[Python][2] is now the [most popular][3], most used programming language. Python's simple syntax and low learning curve make it the ultimate choice for beginners as well as professional developers. Python is also a very versatile programming language. It's used nearly everywhere—from web development to artificial intelligence—really anywhere other than mobile development.
|
||||
|
||||
If you're using Python, there's a good chance you're a developer (or want to become one), and Linux is a great platform for creating software. But when you're working with Python every day, you sometimes want to stay up to date with the very latest version. You may not want to replace the default install of Python on your system just to test drive the latest one, so this article explains how to install the latest version of Python 3 on Linux without replacing the version provided by your distribution.
|
||||
|
||||
Use the **python --version terminal** command to check whether Python is already installed and, if so, which version you have. If Python is not installed on your Linux system, or you want to install an updated version, follow the steps below.
|
||||
|
||||
### Step-by-step installation instructions
|
||||
|
||||
#### **Step 1:** First, install development packages required to build Python.
|
||||
|
||||
#### On Debian:
|
||||
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
$ sudo apt install build-essential zlib1g-dev \
|
||||
libncurses5-dev libgdbm-dev libnss3-dev \
|
||||
libssl-dev libreadline-dev libffi-dev curl
|
||||
```
|
||||
|
||||
#### On Fedora:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf groupinstall development`
|
||||
```
|
||||
|
||||
#### Step 2: Download the stable latest release of Python 3
|
||||
|
||||
Visit the [official Python website][4] and download the latest version of Python 3. After the download is complete, you hav a **.tar.xz** archive file (a "tarball") containing the source code of Python.
|
||||
|
||||
#### Step 3: Extract the tarball
|
||||
|
||||
Once the download is complete, extract the tarball by either using the extractor application of your choice or the [Linux **tar** command][5], for example:
|
||||
|
||||
|
||||
```
|
||||
`$ tar -xf Python-3.?.?.tar.xz`
|
||||
```
|
||||
|
||||
#### Step 4: Configure the script
|
||||
|
||||
Once the Python tarball has been extracted, navigate to the configure script and execute it in your Linux terminal with:
|
||||
|
||||
|
||||
```
|
||||
$ cd Python-3.*
|
||||
./configure
|
||||
```
|
||||
|
||||
The configuration may take some time. Wait until it is successfully finishes before proceeding.
|
||||
|
||||
#### Step 5: Start the build process
|
||||
|
||||
If you already have a version of Python installed on your system and you want to install the new version alongside it, use this command:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo make altinstall`
|
||||
```
|
||||
|
||||
The build process may take some time.
|
||||
|
||||
If you want to replace your current version of Python with this new version, you should uninstall your current Python package using your package manager (such as **apt** or **dnf**) and then install:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo make install`
|
||||
```
|
||||
|
||||
However, it's generally preferable to install software as a package (such as a **.deb** or **.rpm** file) so your system can track and update it for you. Because this article assumes the latest Python isn't yet packaged yet, though, you probably don't have that option. In that case, you can either install Python with **altinstall** as suggested, or rebuild an existing Python package using the latest source code. That's an advanced topic and specific to your distribution, so it's out of scope for this article.
|
||||
|
||||
#### Step 6: Verify the installation
|
||||
|
||||
If you haven't encountered any errors, the latest Python is now installed on your Linux system. To verify it, write one of these commands in your terminal:
|
||||
|
||||
|
||||
```
|
||||
`python3 --version`
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
|
||||
```
|
||||
`python --version`
|
||||
```
|
||||
|
||||
If the output says **Python 3.x**, Python 3 has been successfully installed.
|
||||
|
||||
### Create a virtual environment (optional)
|
||||
|
||||
Python provides a package known as **venv** (virtual environment), which helps you isolate a program directory or package from other ones.
|
||||
|
||||
To create a virtual environment, enter the following in the Python terminal (in this example, assume the version of Python you've installed is in the **3.8** series):
|
||||
|
||||
|
||||
```
|
||||
`python3.8 -m venv example`
|
||||
```
|
||||
|
||||
This command creates a new directory (which I've named **example**), with some subdirectories.
|
||||
|
||||
To activate the virtual environment, enter:
|
||||
|
||||
|
||||
```
|
||||
$ source example/bin/activate
|
||||
(example) $
|
||||
```
|
||||
|
||||
Notice that your terminal prompt (**$**) is now preceeded by an environment name.
|
||||
|
||||
To deactivate the virtual environment, use the **deactivate** command:
|
||||
|
||||
|
||||
```
|
||||
`(example) $ deactivate`
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
Python is a fun language that's developed and improved frequently. Getting familiar with new features is easy, once you understand how to install the latest release without interfering with the stable version provided from your distribution.
|
||||
|
||||
If you have any feedback or questions, please leave them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/install-python-linux
|
||||
|
||||
作者:[Vijay Singh Khatri][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/vijaytechnicalauthor
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM)
|
||||
[2]: https://www.python.org/
|
||||
[3]: http://pypl.github.io/PYPL.html
|
||||
[4]: http://python.org
|
||||
[5]: https://opensource.com/article/17/7/how-unzip-targz-file
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,343 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (Zioyi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (12 Linux Commands to Have Some Fun in the Terminal)
|
||||
[#]: via: (https://itsfoss.com/funny-linux-commands/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
12 Linux Commands to Have Some Fun in the Terminal
|
||||
======
|
||||
|
||||
_**So, you think Linux terminal is all work and no fun? These funny Linux commands will prove you wrong.**_
|
||||
|
||||
The Linux terminal is the place to get serious work done. We have plenty of useful [linux command tips and tricks][1] to help you with that.
|
||||
|
||||
But, did you know that you can have a lot of fun using the terminal? Well, if you did not, then you are not alone. Most Linux users see the terminal as an interface that is designed and built for system management and development tasks.
|
||||
|
||||
However, you will be surprised to know that there are tons of [terminal based games][2] and [ASCII games][3] that you can play in the terminal.
|
||||
|
||||
And, in this article, I’m going to explore some interesting, some funny and some ridiculous commands that you can type into the terminal on Linux and have fun!
|
||||
|
||||
### Have some fun in Linux terminal with these commands
|
||||
|
||||
![][4]
|
||||
|
||||
You’ll find a lot of these commands ridiculous or useless but some of them could actually be put to some good use.
|
||||
|
||||
I have added installation instructions for Ubuntu/Debian. If you are using Ubuntu-based distribution, please make sure to [enable universe repository][5] as most of these commands are not in the main repository.
|
||||
|
||||
If you are using Arch, Fedora, SUSE, Solus or any other non-Ubuntu distributions, please use your distribution’s package manager to install these funny Linux commands.
|
||||
|
||||
#### 1\. Run a train in the terminal
|
||||
|
||||
Let’s take a ride in the locomotive and begin our auspicious journey. And I mean it literally!
|
||||
|
||||
The sl command allows you to run a train in your terminal.
|
||||
|
||||
![][6]
|
||||
|
||||
Here’s how to install the command:
|
||||
|
||||
```
|
||||
sudo apt install sl
|
||||
```
|
||||
|
||||
Once done, you can simply type in the following in the terminal to get started:
|
||||
|
||||
```
|
||||
sl
|
||||
```
|
||||
|
||||
Impressive, isn’t it? But, hold on. We are not done yet! Apparently, you can fly your locomotive. Just add the option -F, Mr. Potter:
|
||||
|
||||
```
|
||||
sl -F
|
||||
```
|
||||
|
||||
****This should make the locomotive get wings to fly off from the terminal window!
|
||||
|
||||
#### 2\. Add the Matrix effect to your Linux terminal
|
||||
|
||||
Remember the iconic sci-fi movie [The Matrix][7]? The green text falling down on the terminal became an identity of Matrix.
|
||||
|
||||
You can have this Matrix digital rain on your Linux box as well! You just need to install **cmatrix** and type it in the terminal.
|
||||
|
||||
![][8]
|
||||
|
||||
Installing cmatrix on Debian/Ubuntu Linux:
|
||||
|
||||
```
|
||||
sudo apt install cmatrix
|
||||
```
|
||||
|
||||
Now, all you have to do is type the following to get the matrix screen on terminal:
|
||||
|
||||
```
|
||||
cmatrix
|
||||
```
|
||||
|
||||
Press Ctrl+C to stop it, Mr. Anderson.
|
||||
|
||||
**Recommended Read:**
|
||||
|
||||
![][9]
|
||||
|
||||
#### [Watch Star Wars In Linux Terminal via Telnet][10]
|
||||
|
||||
Watch Star Wars in ASCII art Linux terminal.
|
||||
|
||||
#### 3\. Let there be fire
|
||||
|
||||
Keep your fire extinguisher handy because now you are going to start a fire in your terminal!
|
||||
|
||||
![][11]
|
||||
|
||||
To get it installed, here’s what you have to type:
|
||||
|
||||
```
|
||||
sudo apt install libaa-bin
|
||||
```
|
||||
|
||||
Once done start a fire in your terminal by entering:
|
||||
|
||||
```
|
||||
aafire
|
||||
```
|
||||
|
||||
Press Ctrl+C to stop it.
|
||||
|
||||
#### 4\. Fortune ~~Cookie~~ Command
|
||||
|
||||
Want to know your fortune but there are no fortune cookies around you?
|
||||
|
||||
Not to worry, you just need to type “fortune” on your terminal and press enter. The terminal will display a random sentence just like you usually get in fortune cookies.
|
||||
|
||||
![][12]
|
||||
|
||||
Install it with:
|
||||
|
||||
```
|
||||
sudo apt install fortune
|
||||
```
|
||||
|
||||
Once done, simply type in the command below to know your fortune:
|
||||
|
||||
```
|
||||
fortune
|
||||
```
|
||||
|
||||
Now this is one of the commands here that you could actually use. You can use it as message of the day so that in a multi-user environment, all the users will see a random fortune cookie when they login.
|
||||
|
||||
You may also add it to your bashrc file so that it shows you a random message as soon as you log in to the terminal.
|
||||
|
||||
#### 5\. Pet lover? This is for you
|
||||
|
||||
Oneko is a little fun command that will change your regular cursor into a mouse and creates a curious little cat who will chase your cursor once you move it. It’s not limited to just the terminal. You can keep on working while the cat chases the cursor.
|
||||
|
||||
Now, that’s something fun to do specially if you have kids at home.
|
||||
|
||||
![][13]
|
||||
|
||||
Install Oneko with this command:
|
||||
|
||||
```
|
||||
sudo apt install oneko
|
||||
```
|
||||
|
||||
Run it with this command:
|
||||
|
||||
```
|
||||
oneko
|
||||
```
|
||||
|
||||
In case you want a dog instead of a cat, type:
|
||||
|
||||
```
|
||||
oneko -dog
|
||||
```
|
||||
|
||||
There are a few more types of cats available. You can get that information by using oneko –help. To stop it, use Ctrl+C.
|
||||
|
||||
#### 6\. Little brother is watching you
|
||||
|
||||
Xeyes is a tiny gui program that let the user draws a pair of ever watching eyes! It will follow your mouse cursor constantly. Run the command and see it yourself!
|
||||
|
||||
![][14]
|
||||
|
||||
You can install it using this command:
|
||||
|
||||
```
|
||||
sudo apt install xeyes
|
||||
```
|
||||
|
||||
And then use it with this:
|
||||
|
||||
```
|
||||
xeyes
|
||||
```
|
||||
|
||||
Press Ctrl+C to stop it.
|
||||
|
||||
#### Let the terminal speak for you
|
||||
|
||||
To try out this command, make sure you have turned on your speakers. [eSpeak][15] is a fun command that gives your terminal a voice. Yes, you heard that right.
|
||||
|
||||
Install the package first:
|
||||
|
||||
```
|
||||
sudo apt install espeak
|
||||
```
|
||||
|
||||
Next, you need to simply type in the command along with a text that you want to listen as audio:
|
||||
|
||||
```
|
||||
espeak "Type what your computer says"
|
||||
```
|
||||
|
||||
Whatever you place in the double quotes, your computer is obligated to say! It’s like [echo command in Linux][16]. But instead of printing, it speaks.
|
||||
|
||||
#### Toilet (but it has nothing to do with a washroom)
|
||||
|
||||
This sounds weird, yes. But, it’s just a command that transforms a text into large ASCII characters.
|
||||
|
||||
![][17]
|
||||
|
||||
Install toilet with this command:
|
||||
|
||||
```
|
||||
sudo apt install toilet
|
||||
```
|
||||
|
||||
Once done, you just need to type in:
|
||||
|
||||
```
|
||||
toilet sample text you want
|
||||
```
|
||||
|
||||
I don’t know why this little program is called toilet.
|
||||
|
||||
#### What does the ~~fox~~ cow say?
|
||||
|
||||
Cowsay is a command that displays a cow using ASCII characters in the terminal. And by using this command you can instruct the cow to say anything you want.
|
||||
|
||||
Not to be confused with any audio – it will just display a text (like you usually see in a comic book).
|
||||
|
||||
![Cowsay Cowthink][18]
|
||||
|
||||
Install ****cowsay:
|
||||
|
||||
```
|
||||
sudo apt install cowsay
|
||||
```
|
||||
|
||||
Once you have it installed, you just need to type in:
|
||||
|
||||
```
|
||||
cowsay "your text"
|
||||
```
|
||||
|
||||
Whatever you place in the double quotes, your cow is obligated to say! I have seen a few sysadmins using it to display the message of the day. Maybe you can do the same. You may even combine it with fortune command.
|
||||
|
||||
#### Banner Command
|
||||
|
||||
The banner command works just like the toilet command but it is limited to print only 10 characters at most.
|
||||
|
||||
![][19]
|
||||
|
||||
You can install banner command like this:
|
||||
|
||||
```
|
||||
sudo apt install sysvbanner
|
||||
```
|
||||
|
||||
Then use it in the following way:
|
||||
|
||||
```
|
||||
banner "Welcome"
|
||||
```
|
||||
|
||||
Replace content in the double quotes and you shall have your desired text displayed.
|
||||
|
||||
#### Yes command
|
||||
|
||||
![][20]
|
||||
|
||||
The “yes” command helps you to loop an automated response until you terminate the command. This command will print the exact same thing indefinitely. If you want to produce huge amounts of junk text fast, then this command will work like a charm.
|
||||
|
||||
You may also use it to provide a yes to a command (if it prompts for it). For example, the apt upgrade command asks for your confirmation, you can use it like this:
|
||||
|
||||
```
|
||||
yes | sudo apt upgrade
|
||||
```
|
||||
|
||||
You don’t need to install any package for it. Yes command is already available.
|
||||
|
||||
Terminate the yes command loop, simply press **CTRL + C**.
|
||||
|
||||
#### Get a new identity, well, sort of
|
||||
|
||||
Want to generate a random fake identity? I give you the command “rig”. Once you place this in the terminal, it will generate a fake identity.
|
||||
|
||||
![][21]
|
||||
|
||||
Install rig with this command:
|
||||
|
||||
```
|
||||
sudo apt install rig
|
||||
```
|
||||
|
||||
Then simply type this:
|
||||
|
||||
```
|
||||
rig
|
||||
```
|
||||
|
||||
It may be used in scripts or web-apps that displays random information but I haven’t done anything of that sort on my own.
|
||||
|
||||
**Wrapping Up**
|
||||
|
||||
I hope you liked this list of fun Linux commands. Which command do you like the most here? Do you know some other such amusing commands? Do share it with us in the comment section.
|
||||
|
||||
![][22]
|
||||
|
||||
### Srimanta Koley
|
||||
|
||||
A passionate writer, a distrohopper and an open source enthusiast, Srimanta is extremely fond of everything related to technology. He loves to read books and has an unhealthy addiction to the 90s!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/funny-linux-commands/
|
||||
|
||||
作者:[Community][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/linux-command-tricks/
|
||||
[2]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[3]: https://itsfoss.com/best-ascii-games/
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fun-linux-commands.png?ssl=1
|
||||
[5]: https://itsfoss.com/ubuntu-repositories/
|
||||
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sl-command.jpg?ssl=1
|
||||
[7]: https://en.wikipedia.org/wiki/The_Matrix
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/matrix-screen-command.png?ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png?fit=732%2C462&ssl=1
|
||||
[10]: https://itsfoss.com/star-wars-linux/
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fire-command.png?ssl=1
|
||||
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fortune-command.jpg?ssl=1
|
||||
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/oneko-command.jpg?ssl=1
|
||||
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/xeyes-command.jpg?ssl=1
|
||||
[15]: https://itsfoss.com/espeak-text-speech-linux/
|
||||
[16]: https://linuxhandbook.com/echo-command/
|
||||
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/toilet-command.jpg?ssl=1
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cowsay-cowthink.jpg?ssl=1
|
||||
[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/banner-command.jpg?ssl=1
|
||||
[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/yes-yourtext.jpg?ssl=1
|
||||
[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/rig-command.jpg?ssl=1
|
||||
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/srimanta.jpg?ssl=1
|
202
sources/tech/20200420 4 Git scripts I can-t live without.md
Normal file
202
sources/tech/20200420 4 Git scripts I can-t live without.md
Normal file
@ -0,0 +1,202 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 Git scripts I can't live without)
|
||||
[#]: via: (https://opensource.com/article/20/4/git-extras)
|
||||
[#]: author: (Vince Power https://opensource.com/users/vincepower)
|
||||
|
||||
4 Git scripts I can't live without
|
||||
======
|
||||
The Git Extras repo hosts more than 60 scripts that add to Git's basic
|
||||
functionality. Here's how to install, use, and contribute to it.
|
||||
![Person using a laptop][1]
|
||||
|
||||
In 2005, [Linus Torvalds][2] created [Git][3] to replace the proprietary distributed source control management solution that he had previously used to maintain the Linux kernel. Since then, Git has become a dominant version-control solution for open source and cloud-native development teams.
|
||||
|
||||
Even feature-rich applications like Git don't have every feature that people want or need, so they make the effort to create them. In the case of Git, that person would be [TJ Holowaychuk][4]. His [Git Extras][5] project hosts more than 60 "extras" with features that expand Git's basic functionality.
|
||||
|
||||
### Using Git Extras
|
||||
|
||||
Here's how to use four of the most popular Git Extras.
|
||||
|
||||
#### git-ignore
|
||||
|
||||
git-ignore is a convenient extra that allows you to manually add file types and comments to the **.git-ignore** file without having to open a text editor. It works with both the global ignore file for your user account and the individual ignore file for the repository you are working in.
|
||||
|
||||
Executing git-ignore without a parameter will list the global ignore file first, then the local ignore files.
|
||||
|
||||
|
||||
```
|
||||
$ git ignore
|
||||
Global gitignore: /home/alice/.gitignore
|
||||
# Numerous always-ignore extensions
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.rej
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*~
|
||||
*.sass-cache
|
||||
|
||||
# OS or Editor folders
|
||||
Thumbs.db
|
||||
\---------------------------------
|
||||
Local gitignore: .gitignore
|
||||
nbproject
|
||||
```
|
||||
|
||||
#### git-info
|
||||
|
||||
git-info retrieves all the information you need to get your head in the context of a repo you are working with. It includes any remote URLs, remote branches, local branches, configuration info, and the last commit.
|
||||
|
||||
|
||||
```
|
||||
$ git info
|
||||
|
||||
## Remote URLs:
|
||||
|
||||
origin [git@github.com][6]:sampleAuthor/git-extras.git (fetch)
|
||||
origin [git@github.com][6]:sampleAuthor/git-extras.git (push)
|
||||
|
||||
## Remote Branches:
|
||||
|
||||
origin/HEAD -> origin/master
|
||||
origin/myBranch
|
||||
|
||||
## Local Branches:
|
||||
|
||||
myBranch
|
||||
* master
|
||||
|
||||
## Most Recent Commit:
|
||||
|
||||
commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7
|
||||
Author: Sample Author <[sampleAuthor@gmail.com][7]>
|
||||
|
||||
Added git-info command.
|
||||
|
||||
Type ´git log´ for more commits, or ´git show <commit id>´ for full commit details.
|
||||
|
||||
## Configuration (.git/config):
|
||||
|
||||
color.diff=auto
|
||||
color.status=auto
|
||||
color.branch=auto
|
||||
user.name=Sample Author
|
||||
user.email=[sampleAuthor@gmail.com][7]
|
||||
core.repositoryformatversion=0
|
||||
core.filemode=true
|
||||
core.bare=false
|
||||
core.logallrefupdates=true
|
||||
core.ignorecase=true
|
||||
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
|
||||
remote.origin.url=[git@github.com][6]:mub/git-extras.git
|
||||
branch.master.remote=origin
|
||||
branch.master.merge=refs/heads/master
|
||||
```
|
||||
|
||||
#### git-mr and git-pr
|
||||
|
||||
These extras do similar things and work in basically the same way.
|
||||
|
||||
* git-mr checks out a merge request from GitLab
|
||||
* git-pr checks out a pull request on GitHub
|
||||
|
||||
|
||||
|
||||
In either case, you just need the merge or pull request number or the full URL, and it will fetch the remote reference, check out the branch, and adjust the config, so Git knows which branch it will replace.
|
||||
|
||||
|
||||
```
|
||||
$ git mr 51
|
||||
From gitlab.com:owner/repository
|
||||
* [new ref] refs/merge-requests/51/head -> mr/51
|
||||
Switched to branch 'mr/51'
|
||||
```
|
||||
|
||||
#### git-release
|
||||
|
||||
By combining **commit**, **tag**, and **push** into a single command, git-release saves a lot of keystrokes for executing three commands that often run in sequence.
|
||||
|
||||
To commit with a specific **<tagname>** and a custom message:
|
||||
|
||||
|
||||
```
|
||||
`$ git release 0.1.0 -m <+ powerful feature added>`
|
||||
```
|
||||
|
||||
#### Other extras
|
||||
|
||||
These are just four of the 60+ Git Extras in the repo. To access the full list of commands available in Git Extras, either review the [Commands.md][8] file in the source repository or run the following command after you install Git Extras.
|
||||
|
||||
|
||||
```
|
||||
`$ git extras --help`
|
||||
```
|
||||
|
||||
### Install Git Extras
|
||||
|
||||
The main prerequisite for Git Extras is having the command-line version of Git installed. If you plan to build from source, you also need additional utilities (e.g., **make**) to be available.
|
||||
|
||||
If you are using a recent version of macOS, Git Extras installation is best handled using [Homebrew][9] (as with most open source tools):
|
||||
|
||||
|
||||
```
|
||||
`$ brew install git-extras`
|
||||
```
|
||||
|
||||
On Linux, Git Extras is available on each platform's native package manager. Sometimes, you need to enable an extra repository, like [EPEL][10] on CentOS, then run a single command:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo yum install git-extras`
|
||||
```
|
||||
|
||||
Full installation instructions for other Linux distributions, BSD, and other platforms are available in the [Installation.md][11] file in the repository.
|
||||
|
||||
### Contributing
|
||||
|
||||
Do you have a piece of functionality you think is missing from Git and have built or want to build a script to handle it? Why not share it with the world by making it part of the Git Extras distribution!
|
||||
|
||||
To do so, contribute the functionality to the Git Extras repository. There are more specific details in the [CONTRIBUTING.md][12] file in the repository, but the basics are easy:
|
||||
|
||||
1. Create a Bash script that handles the functionality.
|
||||
2. Create a basic man file so people will know how to use it.
|
||||
3. Update the command list and completion scripts to let people know the functionality exists.
|
||||
4. Run the integrity check to make sure you didn't break anything.
|
||||
5. Create a pull request for your functionality.
|
||||
|
||||
|
||||
|
||||
Contributing to Git Extras will go a long way towards making life a little easier for your fellow Git users. You can learn more about it in the project's [README][13].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/git-extras
|
||||
|
||||
作者:[Vince Power][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/vincepower
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
|
||||
[2]: https://en.wikipedia.org/wiki/Linus_Torvalds
|
||||
[3]: https://git-scm.com/
|
||||
[4]: https://github.com/tj
|
||||
[5]: https://github.com/tj/git-extras
|
||||
[6]: mailto:git@github.com
|
||||
[7]: mailto:sampleAuthor@gmail.com
|
||||
[8]: https://github.com/tj/git-extras/blob/master/Commands.md
|
||||
[9]: https://brew.sh/
|
||||
[10]: https://fedoraproject.org/wiki/EPEL
|
||||
[11]: https://github.com/tj/git-extras/blob/master/Installation.md
|
||||
[12]: https://github.com/tj/git-extras/blob/master/CONTRIBUTING.md
|
||||
[13]: https://github.com/tj/git-extras/blob/master/Readme.md
|
@ -0,0 +1,99 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (New open source GIS projects for Kubernetes applications)
|
||||
[#]: via: (https://opensource.com/article/20/4/gis-kubernetes)
|
||||
[#]: author: (Adam Timm https://opensource.com/users/timmam)
|
||||
|
||||
New open source GIS projects for Kubernetes applications
|
||||
======
|
||||
pg_tileserv and pg_featureserv make it easier for developers to add
|
||||
location services to Kubernetes applications.
|
||||
![A map with a route highlighted][1]
|
||||
|
||||
Spatial data from geographic information systems (GIS) is all around us. From smartphones that make our lives better and more convenient to precision agriculture that is increasing the amount of food farmers can produce while reducing the cost, whether or not we realize it, almost every part of our lives is touched by spatial data.
|
||||
|
||||
This increase of spatial data is simultaneously bringing an increase of open spatial datasets that people can consume and use to build all sorts of new applications. However, these types of datasets have not always been easy to work with. Also, due to the size of some of the geographic data, they can be difficult to bring to modern application deployment frameworks such as Kubernetes.
|
||||
|
||||
To help with these issues, [Crunchy Data][2] recently announced two new open source projects, [pg_tileserv][3] and [pg_featureserv][4], to make it easier to develop cloud-native spatial applications. These projects, part of open source [Crunchy Spatial][5], help developers leverage the robust [PostGIS][6] geospatial database extension to [PostgreSQL][7] without having to write complex SQL statements.
|
||||
|
||||
So what are pg_tileserv and pg_featuresev, how do they make it easier for developers to add location services to their Kubernetes applications, and what does this mean for the future of spatial applications?
|
||||
|
||||
### Traditional GIS vs. modern spatial microservices
|
||||
|
||||
Traditionally, when an organization or individual works with spatial data, they start with a product that grew up as a GIS. There are many high-quality open source GIS products ([QGIS][8], [GeoServer][9], [GeoNode][10], etc.), but they may not align with modern, cloud-native approaches to software design.
|
||||
|
||||
The popularity of Kubernetes creates challenges for these legacy applications around automation and deployment, as they require a lot of manual configuration, for example, when data sources are added and modified. In many setups, these spatial applications must exist outside Kubernetes and cannot leverage many of the conveniences it provides.
|
||||
|
||||
In contrast, modern spatial services should be driven by the spatial data that they are processing and serving out. They should align with modern software development practices and scale efficiently and integrate easily with developer workflows.
|
||||
|
||||
Applications that are spatially aware also need to ensure they can handle the unique characteristics of spatial data (e.g., geometries, projections, etc.). To do all of this in independent microservices can be challenging unless you have a highly capable database to do the majority of the work for you. This is where pg_tileserv and pg_featureserv help, as both projects leverage the power of PostGIS, an open source geospatial extension to PostgreSQL, to provide advanced spatial capabilities from a simple REST framework
|
||||
|
||||
### Generate map vector tiles with pg_tileserv
|
||||
|
||||
![pg_tileserv][11]
|
||||
|
||||
pg_tileserv is a lightweight vector tile server written in Go that enables you to generate [vector tiles][12] directly from PostGIS. It does this by implementing the **ST_AsMVT()** function in a best-practice method that translates an HTTP request to the database. It includes common defaults that allow you to pass a database connection URL to the server and be up and running in no time. There's no heavyweight software to install and configure, and it's designed for cloud-native GIS applications.
|
||||
|
||||
For specific examples on how to use it, check out our blog posts on [tile serving][13] and [spatial tile serving with PostgreSQL functions][14].
|
||||
|
||||
### Annotate your maps with pg_featureserv
|
||||
|
||||
![pg_featureserv][15]
|
||||
|
||||
pg_featureserv is a lightweight service written in Go that enables you to serve features directly out of PostGIS. It implements the [OGC API][16] for features and provides a standard REST endpoint for your spatial data and functions contained in PostGIS. Just like pg_tileserv, there's no heavyweight software to install; just pass a database connection URL to your PostGIS database, and you're off to the races. For a specific example of how to use it, check out our post on [querying spatial features][17].
|
||||
|
||||
### Focus on spatial data, not GIS
|
||||
|
||||
With our deep background in developing PostGIS and building PostGIS-backed applications, we wanted to help developers unlock all the value of spatial data in a way that is easy to deploy, scale, and maintain. As the source code of pg_tileserv and pg_featureserv show, we are just leveraging functions already in PostGIS. This allows developers to quickly add spatial data to their applications and data scientists to focus on the data.
|
||||
|
||||
![GIS architecture][18]
|
||||
|
||||
The benefits of this approach are:
|
||||
|
||||
* Faster performance because PostgreSQL and PostGIS are doing the work for you
|
||||
* Less configuration to maintain because the database structure is the configuration
|
||||
* By design, it runs in the cloud at enterprise scale from the start
|
||||
* Shorter times to update customer-facing applications—when you update your data in the database, your application is updated instantly
|
||||
* Ability to focus more on maintaining your data and delivering value to your users and less on wrangling software
|
||||
|
||||
|
||||
|
||||
Also, since these services respond to the configuration of your database, they also expose functions contained in the database. Rather than developing their data functions to incorporate them into software later, data scientists can create functions in the database that are immediately made available via a REST API. The software begins to fade into the background so an organization can focus on the data.
|
||||
|
||||
Suffice it to say, we're pretty excited about these new geospatial services, and we definitely want your feedback on them. Feel free to check out [pg_tileserve][3] and [pg_featureserv][4], try deploying them alongside your PostGIS databases with the [PostgreSQL Operator][19], and share your feedback in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/gis-kubernetes
|
||||
|
||||
作者:[Adam Timm][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/timmam
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/map_route_location_gps_path.png?itok=RwtS4DsU (A map with a route highlighted)
|
||||
[2]: https://www.crunchydata.com/
|
||||
[3]: https://github.com/CrunchyData/pg_tileserv
|
||||
[4]: https://github.com/CrunchyData/pg_featureserv
|
||||
[5]: https://www.crunchydata.com/products/crunchy-spatial/
|
||||
[6]: https://postgis.net/
|
||||
[7]: https://www.postgresql.org
|
||||
[8]: https://www.qgis.org/en/site/
|
||||
[9]: http://geoserver.org/
|
||||
[10]: http://geonode.org/
|
||||
[11]: https://opensource.com/sites/default/files/pg_tileserv.jpg (pg_tileserv)
|
||||
[12]: https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis
|
||||
[13]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving
|
||||
[14]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving-with-postgresql-functions
|
||||
[15]: https://opensource.com/sites/default/files/pg_featureserv.jpg (pg_featureserv)
|
||||
[16]: http://www.ogcapi.org/
|
||||
[17]: https://info.crunchydata.com/blog/crunchy-spatial-querying-spatial-features-with-pg_featureserv
|
||||
[18]: https://opensource.com/sites/default/files/uploads/architecture_0.png (GIS architecture)
|
||||
[19]: https://github.com/CrunchyData/postgres-operator
|
@ -0,0 +1,97 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (MystiQ: A Free and Open Source Audio/Video Converter)
|
||||
[#]: via: (https://itsfoss.com/mystiq/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
MystiQ: A Free and Open Source Audio/Video Converter
|
||||
======
|
||||
|
||||
_**Brief: MystiQ is a new open-source video converter tool available for Linux and Windows. It uses FFMPEG underneath and provides you a neat and clean graphical interface based on Qt.**_
|
||||
|
||||
### MystiQ, a QT-based GUI Frontend for FFmpeg
|
||||
|
||||
![][1]
|
||||
|
||||
An audio/video conversion tool always comes in handy for every computer user across multiple platforms.
|
||||
|
||||
For that very same reason, I thought it would be a great idea to highlight the [MystiQ app][2] – which is a relatively new video/audio converter tool available for Linux and Windows users. As of now, there’s no support for macOS – but it could arrive in the near future.
|
||||
|
||||
MystiQ is a graphical frontend for [FFmpeg][3] based on [Qt 5 user interface][4]. Now, you can always [install and use ffmpeg in Linux command line][5] but that’s not very comfortable, is it? This is why tools like [Handbrake][6] and MystiQ exist to make our life easier.
|
||||
|
||||
Since MystiQ is based on FFmpeg, you can use it for some basic video editing like trimming a video, rotating it etc.
|
||||
|
||||
Let’s have a look at its features.
|
||||
|
||||
### Features of MystiQ video converter
|
||||
|
||||
![][7]
|
||||
|
||||
Even though the MystiQ app is fairly new to the scene – it packs a good set of essential features. Here’s an overview of what it offers:
|
||||
|
||||
* Video conversion
|
||||
* Audio conversion (extracting the audio from the video as well)
|
||||
* Formats supported: MP4, WEBM, MKV, MP3, MOV, OGG, WAV, ASF, FLV, 3GP, M4A, and a few others.
|
||||
* Cross-platform (Windows & Linux)
|
||||
* Packages for both 32-bit and 64-bit systems available
|
||||
* Ability to tweak the audio quality (sample rate, bit rate, etc,.) for conversion
|
||||
* **Basic video editing capabilities** (clipping the video, inserting a subtitle, rotating the video, scaling the video, etc)
|
||||
* Convert your color video to black and white
|
||||
* Several presets available to easily convert a video for the best quality or for the best compression.
|
||||
|
||||
|
||||
|
||||
**Recommended Read:**
|
||||
|
||||
![][8]
|
||||
|
||||
#### [Easily Convert Audio File Formats with SoundConverter in Linux][9]
|
||||
|
||||
If you are looking for converting audio file formats to wav, mp3, ogg or any other format, SoundConverter is the tool you need in Linux.
|
||||
|
||||
### Installing MystiQ
|
||||
|
||||
You may not find it listed in your software center – but it is quite easy to get it installed on a Linux distro.
|
||||
|
||||
It provides an **.AppImage file** and **.deb/.rpm** files (with 32-bit and 64-bit packages). If you’re curious, you can read [how to use the AppImage file][10] if you want to use that.
|
||||
|
||||
You can also find their [GitHub page][11] and look at the source code or any recent pre-release packages if you want to help them test the software to improve it.
|
||||
|
||||
You can download the installer files for both Linux and Windows from its official website.
|
||||
|
||||
[Download MystiQ][2]
|
||||
|
||||
**Wrapping Up**
|
||||
|
||||
For this quick highlight article, I used [Pop!_OS][12] 20.04 to test the MytiQ converter app and I had no issues converting video and audio files. And, the conversion was fast enough for an average user like me.
|
||||
|
||||
Feel free to try it out and let me know your thoughts on it! Also, if you’ve been using another tool to convert videos and audio on Linux, what is it?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/mystiq/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-converter-ft.jpg?ssl=1
|
||||
[2]: https://mystiqapp.com/
|
||||
[3]: https://www.ffmpeg.org/
|
||||
[4]: https://www.qt.io/
|
||||
[5]: https://itsfoss.com/ffmpeg/
|
||||
[6]: https://itsfoss.com/handbrake/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-options.jpg?ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/Convert-audio-file-format-linux.png?fit=800%2C450&ssl=1
|
||||
[9]: https://itsfoss.com/sound-converter-linux/
|
||||
[10]: https://itsfoss.com/use-appimage-linux/
|
||||
[11]: https://github.com/swl-x/MystiQ/
|
||||
[12]: https://system76.com/pop
|
@ -7,155 +7,136 @@
|
||||
[#]: via: (https://opensource.com/article/20/2/git-great-teeming-workspaces)
|
||||
[#]: author: (Daniel Gryniewicz https://opensource.com/users/dang)
|
||||
|
||||
Manage complex Git workspaces with Great Teeming Workspaces
|
||||
使用 Great Teeming Workspaces 管理复杂的 Git 工作空间
|
||||
======
|
||||
GTWS is a set of scripts that make it easy to have development
|
||||
environments for different projects and different versions of a project.
|
||||
GTWS 是一系列脚本,这些脚本能让我们在开发环境中管理一个有不同项目和不同版本的工程时变得更简单。
|
||||
![Coding on a computer][1]
|
||||
|
||||
Great Teeming Workspaces ([GTWS][2]) is a complex workspace management package for Git that makes it easy to have development environments for different projects and different versions of a project.
|
||||
[GTWS][2] 是一个 Git 的复杂工作空间管理工具包,可以让我们在开发环境中管理一个有不同项目和不同版本的工程时变得更简单。
|
||||
|
||||
Somewhat like Python [venv][3], but for languages other than Python, GTWS handles workspaces for multiple versions of multiple projects. You can create, update, enter, and leave workspaces easily, and each project or version combination has (at most) one local origin that syncs to and from the upstream—all other workspaces update from the local origin.
|
||||
|
||||
### Layout
|
||||
有点像 Python 的 [venv][3],但不是为 Python 语言准备的。GTWS 用来处理多项目的多个版本的工作空间。你可以很容易地创建、更新、进入和离开工作空间,每个项目或版本的组合(最多)有一个本地的 origin,用来与 upstream 同步 — 其余的所有工作空间都从本地的 origin 更新。
|
||||
|
||||
### 部署
|
||||
|
||||
```
|
||||
${GTWS_ORIGIN}/<project>/<repo>[/<version>]
|
||||
${GTWS_BASE_SRCDIR}/<project>/<version>/<workspacename>/{<repo>[,<repo>...]}
|
||||
```
|
||||
|
||||
Each level in the source tree (plus the homedir for globals) can contain a **.gtwsrc** file that maintains settings and Bash code relevant to that level. Each more specific level overrides the higher levels.
|
||||
源目录的每一级(包括全局的 home 目录)可以包含一个 **.gtwsrc** 文件,这个文件中维护与当前级相关的设置和 bash 代码。每一级的配置会覆盖上一级。
|
||||
|
||||
### Setup
|
||||
|
||||
Check out GTWS with:
|
||||
### 安装
|
||||
|
||||
用下面的命令检出 GTWS:
|
||||
|
||||
```
|
||||
`git clone https://github.com/dang/gtws.git`
|
||||
```
|
||||
|
||||
Set up your **${HOME}/.gtwsrc**. It should include **GTWS_ORIGIN** and optionally **GTWS_SETPROMPT**.
|
||||
|
||||
Add the repo directory to your path:
|
||||
配置你的 **${HOME}/.gtwsrc**。它应该包含 **GTWS_ORIGIN**,也可以再包含 **GTWS_SETPROMPT**。
|
||||
|
||||
把仓库目录加到环境变量中:
|
||||
|
||||
```
|
||||
`export PATH="${PATH}:/path/to/gtws`
|
||||
```
|
||||
|
||||
### Configuration
|
||||
### 配置
|
||||
|
||||
Configuration is via cascading **.gtwsrc** files. It walks the real path down from the root, and each **.gtwsrc** file it finds is sourced in turn. More specific files override less specific files.
|
||||
通过级联 **.gtwsrc** 文件来进行配置。它从根目录向下遍历,会执行在每级目录中找到的 **.gtwsrc** 文件。下级目录的文件会覆盖上一级。
|
||||
|
||||
Set the following in your top-level **~/.gtws/.gtwsrc**:
|
||||
在你最上层的文件 **~/.gtws/.gtwsrc** 中进行如下设置:
|
||||
|
||||
* **GTWS_BASE_SRCDIR:** This is the base of all the projects' source trees. It defaults to **$HOME/src**.
|
||||
* **GTWS_ORIGIN:** This sets the location of the origin Git trees. It defaults to **$HOME/origin**.
|
||||
* **GTWS_SETPROMPT:** This is optional. If it's set, the shell prompt will have the workspace name in it.
|
||||
* **GTWS_DEFAULT_PROJECT:** This is the project used when no project is given or known. If it is not given, projects must be specified on the command line.
|
||||
* **GTWS_DEFAULT_PROJECT_VERSION:** This is the default version to check out. It defaults to **master**.
|
||||
* **GTWS_BASE_SRCDIR:** 所有项目源文件目录树的 base。默认为 **$HOME/src**。
|
||||
* **GTWS_ORIGIN:** 指定 origin git 目录树的路径。默认为 **$HOME/origin**。
|
||||
* **GTWS_SETPROMPT:** 可选配置。如果配置了这个参数,shell 提示符会有工作空间的名字。
|
||||
* **GTWS_DEFAULT_PROJECT:** 不指定项目或项目未知时默认的项目名。如果不指定,使用命令行时必须指明项目。
|
||||
* **GTWS_DEFAULT_PROJECT_VERSION:** 检出的默认版本。默认为 **master**。
|
||||
|
||||
在每个项目的根目录进行以下设置:
|
||||
|
||||
* **GTWS_PROJECT:** 项目的名字(和 base 目录)。
|
||||
* **gtws_project_clone:** 这个函数用于克隆一个项目的指定版本。如果未定义,它会假定项目的 origin 对每一个版本都有一个单独的目录,这样会导致克隆一堆 Git 仓库。
|
||||
* **gtws_project_setup:** 在克隆完所有的仓库后,可以选择是否调用这个函数,调用后可以对项目进行必要的配置,如在 IDE 中配置工作空间。
|
||||
|
||||
Set the following at the project level of each project:
|
||||
在项目版本级进行以下设置:
|
||||
|
||||
* **GTWS_PROJECT:** The name (and base directory) of the project.
|
||||
* **gtws_project_clone:** This function is used to clone a specific version of a project. If it is not defined, then it is assumed that the origin for the project contains a single directory per version, and that contains a set of Git repos to clone.
|
||||
* **gtws_project_setup:** This optional function is called after all cloning is done and allows any additional setup necessary for the project, such as setting up workspaces in an IDE.
|
||||
* **GTWS_PROJECT_VERSION:** 项目的版本。用于正确地从 origin 拉取代码。类似 Git 中的分支名字。
|
||||
|
||||
下面这些参数可以在目录树的任意地方进行配置,如果能生效,它们可以被重写多次:
|
||||
|
||||
* **GTWS_PATH_EXTRA:** 这些是工作空间中加到路径后的额外的路径元素。
|
||||
* **GTWS_FILES_EXTRA:** 这些是不在版本控制内,但应该在工作空间中被检出的额外的文件。这些文件包括 **.git/info/exclude**,每个文件都与仓库的 base 相关联。
|
||||
|
||||
Set this at the project version level:
|
||||
### origin 目录
|
||||
|
||||
* **GTWS_PROJECT_VERSION:** This is the version of the project. It's used to pull from the origin correctly. In Git, this is likely the branch name.
|
||||
**GTWS_ORIGIN** (大部分脚本中)指向拉取和推送的原始 Git 检出目录。
|
||||
|
||||
|
||||
|
||||
These things can go anywhere in the tree and can be overridden multiple times, if it makes sense:
|
||||
|
||||
* **GTWS_PATH_EXTRA:** These are extra path elements to be added to the path inside the workspace.
|
||||
* **GTWS_FILES_EXTRA:** These are extra files not under version control that should be copied into each checkout in the workspace. This includes things like **.git/info/exclude**, and each file is relative to the base of its repo.
|
||||
|
||||
|
||||
|
||||
### Origin directories
|
||||
|
||||
**GTWS_ORIGIN** (in most scripts) points to the pristine Git checkouts to pull from and push to.
|
||||
|
||||
Layout of **${GTWS_ORIGIN}**:
|
||||
**${GTWS_ORIGIN}** 部署:
|
||||
|
||||
* **/<project>**
|
||||
* This is the base for repos for a project.
|
||||
* If **gtws_project_clone** is given, this can have any layout you desire.
|
||||
* If **gtws_project_clone** is not given, this must contain a single subdirectory named **git** that contains a set of bare Git repos to clone.
|
||||
* 这是一个项目的仓库 base。
|
||||
* 如果指定了 **gtws_project_clone**,你可以配置任意的部署路径。
|
||||
* 如果没有指定 **gtws_project_clone**,这个路径下必须有个名为 **git** 的子目录,且 **git** 目录下有一系列用来克隆的裸 Git 仓库。
|
||||
|
||||
### 工作流示例
|
||||
|
||||
假设你有一个项目名为 **Foo**,它的 upstream 为 **github.com/foo/foo.git**。这个仓库有个名为 **bar** 的子模块,它的 upstream 是 **github.com/bar/bar.git**。Foo 项目在 master 分支开发,使用稳定版本的分支。
|
||||
|
||||
### Workflow example
|
||||
为了能在 Foo 中使用 GTWS,你首先要配置目录结构。本例中假设你使用默认的目录结构。
|
||||
|
||||
Suppose you have a project named **Foo** that has an upstream repository at **github.com/foo/foo.git**. This repo has a submodule named **bar** with an upstream at **github.com/bar/bar.git**. The Foo project does development in the master branch and uses stable version branches.
|
||||
|
||||
Before you can use GTWS with Foo, first you must set up the directory structure. These examples assume you are using the default directory structure.
|
||||
|
||||
* Set up your top level **.gtwsrc**:
|
||||
* 配置你最上层的 **.gtwsrc**:
|
||||
* **cp ${GTWS_LOC}/examples/gtwsrc.top ~/.gtwsrc**
|
||||
* Edit **~/.gtwsrc** and change as necessary.
|
||||
* Create top-level directories:
|
||||
* 根据需要修改 **~/.gtwsrc**。
|
||||
* 创建顶级目录:
|
||||
* **mkdir -p ~/origin ~/src**
|
||||
* Create and set up the project directory:
|
||||
* 创建并配置项目目录:
|
||||
* **mkdir -p ~/src/foo**
|
||||
**cp ${GTWS_LOC}/examples/gtwsrc.project ~/src/foo/.gtwsrc**
|
||||
* Edit **~/src/foo/.gtwsrc** and change as necessary.
|
||||
* Create and set up the master version directory:
|
||||
* 根据需要修改 **~/src/foo/.gtwsrc**。
|
||||
* 创建并配置 master 版本目录:
|
||||
* **mkdir -p ~/src/foo/master**
|
||||
**cp ${GTWS_LOC}/examples/gtwsrc.version ~/src/foo/master/.gtwsrc**
|
||||
* Edit **~/src/foo/master/.gtwsrc** and change as necessary.
|
||||
* Go to the version directory and create a temporary workspace to set up the mirrors:
|
||||
* 根据需要修改 **~/src/foo/master/.gtwsrc**。
|
||||
* 进入版本目录并创建一个临时工作空间来配置镜像:
|
||||
* **mkdir -p ~/src/foo/master/tmp**
|
||||
**cd ~/src/foo/master/tmp
|
||||
git clone --recurse-submodules git://github.com/foo/foo.git
|
||||
cd foo
|
||||
gtws-mirror -o ~/origin -p foo**
|
||||
* This will create **~/origin/foo/git/foo.git** and **~/origin/foo/submodule/bar.git**.
|
||||
* Future clones will clone from these origins rather than from upstream.
|
||||
* This workspace can be deleted now.
|
||||
gtws-mirror -o ~/origin -p foo**(译注:这个地方原文有误,不加 `-s` 参数会报错)
|
||||
* 上面命令会创建 **~/origin/foo/git/foo.git** 和 **~/origin/foo/submodule/bar.git**。
|
||||
* 以后的克隆操作会从这些 origin 而不是 upstream 克隆。
|
||||
* 现在可以删除工作空间了。
|
||||
|
||||
到现在为止,Foo 的 master 分支的工作可以结束了。假设你现在想修复一个 bug,名为 **bug1234**。你可以脱离你当前的工作空间为修复这个 bug 单独创建一个工作空间,之后在新创建的工作空间中开发。
|
||||
|
||||
|
||||
At this point, work can be done on the master branch of Foo. Suppose you want to fix a bug named **bug1234**. You can create a workspace for this work to keep it isolated from anything else you're working on, and then work within this workspace.
|
||||
|
||||
* Go to the version directory, and create a new workspace:
|
||||
* 进入版本目录,创建一个新的工作空间:
|
||||
* **cd ~/src/foo/master
|
||||
mkws bug1234**
|
||||
* This creates **bug1234/**, and inside it checks out Foo (and its submodule **bar**) and makes **build/foo** for building it.
|
||||
* Enter the workspace. There are two ways to do this:
|
||||
* 上面的命令创建了 **bug1234/**,在这个目录下检出了 Foo(和它的子模块 **bar**),并创建了 **build/foo** 来构建它。
|
||||
* 有两种方式进入工作空间:
|
||||
* **cd ~/src/foo/master/bug1234
|
||||
startws**
|
||||
or
|
||||
或者
|
||||
**cd ~/src/foo/master/**
|
||||
**startws bug1234**
|
||||
* This starts a subshell within the bug1234 workspace. This shell has the GTWS environment plus any environment you set up in your stacked **.gtwsrc** files. It also adds the base of the workspace to your CD path, so you can **cd** into relative paths from that base.
|
||||
* At this point, you can do work on bug1234, build it, test it, and commit your changes. When you're ready to push to upstream, do this:
|
||||
* 上面的命令在 bug1234 工作空间中开启了一个子 shell。这个 shell 有 GTWS 的环境和你在各级 **.gtwsrc** 文件中设置的环境。它也把你工作空间的 base 路径加入到了 CD,因此你可以从 base 路径 **cd** 到相关的目录中。
|
||||
* 现在你可以修复 bug1234了,构建、测试、提交你的修改。当你可以把代码推送到 upstream 时,执行下面的命令:
|
||||
**cd foo
|
||||
wspush**
|
||||
* **wspush** will push the branch associated with your workspace—first to your local origin and then to the upstream.
|
||||
* If upstream changes. you can sync your local checkout using:
|
||||
* **wspush** 会把代码推送到与你工作空间相关的分支 — 先推送到本地的 origin,再推送到 upstream。
|
||||
* 当 upstream 有修改时,你可以用下面的命令同步到本地:
|
||||
**git sync**
|
||||
* This envokes the **git-sync** script in GTWS, which will update your checkout from the local origin. To update the local origin, use:
|
||||
* 上面的命令调用了 GTWS 的 **git-sync** 脚本,会从本地 origin 更新代码。使用下面的命令来更新本地的 origin:
|
||||
**git sync -o**
|
||||
* This will update your local origin and submodules' mirrors, then use those to update your checkout. **git-sync** has other nice features.
|
||||
* When you're done using the workspace, just exit the shell:
|
||||
* 上面的命令会更新你本地的 origin 和子模块的镜像,然后用那些命令来更新你的检出仓库的代码。**git-sync** 也有一些其他的很好的工鞥。
|
||||
* 当要结束工作空间中的工作时,直接退出 shell:
|
||||
**exit**
|
||||
* You can re-enter the workspace at any time and have multiple shells in the same workspace at the same time.
|
||||
* When you're done with a workspace, you can remove it using the **rmws** command or just remove its directory tree.
|
||||
* There is a script named **tmws** that enters a workspace within tmux, creating a set of windows/panes that are fairly specific to my workflow. Feel free to modify it to suit your needs.
|
||||
|
||||
|
||||
|
||||
### The script
|
||||
* 你可以在任何时间重复进入工作空间,也可以在同一时间在相同的工作空间中开多个 shell。
|
||||
* 当你不需要某个工作空间时,你可以使用 **rmws** 来删除它,或者直接删除它的目录树。
|
||||
* 还有一个脚本 **tmws** 使用 tmux 进入工作空间,能创建一系列的窗口/窗格,这完美契合我的工作流。你可以根据你自己的需求来修改它。
|
||||
|
||||
### 脚本内容
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
@ -1157,7 +1138,7 @@ via: https://opensource.com/article/20/2/git-great-teeming-workspaces
|
||||
|
||||
作者:[Daniel Gryniewicz][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
157
translated/tech/20200413 How to install Python on Linux.md
Normal file
157
translated/tech/20200413 How to install Python on Linux.md
Normal file
@ -0,0 +1,157 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to install Python on Linux)
|
||||
[#]: via: (https://opensource.com/article/20/4/install-python-linux)
|
||||
[#]: author: (Vijay Singh Khatri https://opensource.com/users/vijaytechnicalauthor)
|
||||
|
||||
如何在 Linux 上安装 Python
|
||||
======
|
||||
在 Linux 上安装最新 Python (或并列多个)而不是老版本的分步说明。
|
||||
![OpenStack source code \(Python\) in VIM][1]
|
||||
|
||||
[Python][2] 现在是[最受欢迎][3],最常用的编程语言。Python 的简单语法和较低的学习曲线使其成为初学者和专业开发人员的最终选择。Python 还是一种非常通用的编程语言。从 Web 开发到人工智能,它几乎在除了移动开发的所有地方都有使用。
|
||||
|
||||
如果你使用的是 Python,那么你很有可能是一名开发人员(或想成为一名开发人员),而 Linux 是创建软件的绝佳平台。但是,当你每天使用 Python 时,有时你希望使用最新版本。你可能不想仅仅为了测试最新版本的系统而替换了默认的 Python 安装,因此本文说明了如何在 Linux 上安装最新版本的 Python 3,而不替换发行版提供的版本。
|
||||
|
||||
使用 **python --version terminal** 命令检查是否已安装 Python,如果已安装,那么检查是哪个版本。如果你的 Linux 系统上未安装 Python,或者你想安装更新的版本,请按照以下步骤操作。
|
||||
|
||||
### 分步安装说明
|
||||
|
||||
#### **步骤 1:**首先,安装构建 Python 所需的开发包。
|
||||
|
||||
#### 在 Debian 上:
|
||||
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
$ sudo apt install build-essential zlib1g-dev \
|
||||
libncurses5-dev libgdbm-dev libnss3-dev \
|
||||
libssl-dev libreadline-dev libffi-dev curl
|
||||
```
|
||||
|
||||
#### 在 Fedora 上:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf groupinstall development`
|
||||
```
|
||||
|
||||
#### 步骤 2:下载稳定的最新版本的 Python 3
|
||||
|
||||
访问[官方 Python 网站][4]并下载最新版本的 Python3。下载完成后,你会有一个 **.tar.xz** 归档文件(“tarball”),其中包含 Python 的源代码。
|
||||
|
||||
#### 步骤 3:解压 tarball
|
||||
|
||||
下载完成后,使用解压程序或 [Linux 的 **tar** 命令][5]解压压缩包,例如:
|
||||
|
||||
```
|
||||
`$ tar -xf Python-3.?.?.tar.xz`
|
||||
```
|
||||
|
||||
#### 步骤 4:配置脚本
|
||||
|
||||
解压 Python 压缩包后,进入 configure 脚本所在目录并在 Linux 终端中使用以下命令执行该脚本:
|
||||
|
||||
|
||||
```
|
||||
$ cd Python-3.*
|
||||
./configure
|
||||
```
|
||||
|
||||
配置可能需要一些时间。等待直到成功完成,然后再继续。
|
||||
|
||||
#### 步骤 5:开始构建过程
|
||||
|
||||
如果你的系统上已经安装了某个版本的 Python,并且希望同时安装新版本的 Python,请使用以下命令:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo make altinstall`
|
||||
```
|
||||
|
||||
构建过程可能需要一些时间。
|
||||
|
||||
如果要使用此版本替换当前版本的 Python,那么应使用包管理器(例如 **apt** 或 **dnf**)卸载当前的 Python 包,然后安装:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo make install`
|
||||
```
|
||||
|
||||
但是,通常最好将软件作为包安装(例如 **.deb** 或 **.rpm** 文件),以便系统可以为你跟踪和更新它。因为本文假设尚未打包最新的 Python,所以你可能没有这个选择。在这种情况下,你可以按照建议使用 **altinstall** 来安装 Python,或者使用最新的源代码重建现有的 Python 包。这是一个高级主题,并且特定于你的发行版,因此不在本文讨论范围之内。
|
||||
|
||||
#### 步骤 6:验证安装
|
||||
|
||||
如果你没有遇到任何错误,那么现在你的 Linux 系统上已安装了最新的 Python。要进行验证,请在终端中输入以下命令之一:
|
||||
|
||||
|
||||
```
|
||||
`python3 --version`
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
|
||||
```
|
||||
`python --version`
|
||||
```
|
||||
|
||||
如果输出显示 **Python 3.x**,那么说明 Python 3 已成功安装。
|
||||
|
||||
### 创建虚拟环境(可选)
|
||||
|
||||
Python 提供了名为 **venv**(虚拟环境)的软件包,可帮助你将程序目录或软件包与其他目录或软件包隔离。
|
||||
|
||||
要创建虚拟环境,请在 Python 终端中输入以下内容(在此示例中,假定你安装的 Python 版本为 **3.8** 系列):
|
||||
|
||||
|
||||
```
|
||||
`python3.8 -m venv example`
|
||||
```
|
||||
|
||||
该命令创建一个带有一些子目录的新目录(我将其命名为 **example**)。
|
||||
|
||||
要激活虚拟环境,请输入:
|
||||
|
||||
|
||||
```
|
||||
$ source example/bin/activate
|
||||
(example) $
|
||||
```
|
||||
|
||||
请注意,你的终端提示符(**$**)现在以环境名称开头。
|
||||
|
||||
要停用虚拟环境,请使用 **deactivate** 命令:
|
||||
|
||||
|
||||
```
|
||||
`(example) $ deactivate`
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
Python 是一种有趣的语言,经常被开发和改进。一旦了解了如何安装最新版本而又不干扰发行版提供的稳定版本,熟悉新功能将很容易。
|
||||
|
||||
如果你有任何反馈或问题,请在评论中提出。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/install-python-linux
|
||||
|
||||
作者:[Vijay Singh Khatri][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/vijaytechnicalauthor
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM)
|
||||
[2]: https://www.python.org/
|
||||
[3]: http://pypl.github.io/PYPL.html
|
||||
[4]: http://python.org
|
||||
[5]: https://opensource.com/article/17/7/how-unzip-targz-file
|
@ -0,0 +1,343 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (Zioyi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (12 Linux Commands to Have Some Fun in the Terminal)
|
||||
[#]: via: (https://itsfoss.com/funny-linux-commands/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
12个有趣的Linux终端命令
|
||||
======
|
||||
|
||||
_**你觉得Linux终端里只有无趣的工作吗?那你一定不知道下面这些有趣的Linux命令吧。**_
|
||||
|
||||
Linux终端是用来完成复杂的工作的,我们有很多有用的[linux命令奇技淫巧][1]来帮助你。
|
||||
|
||||
但是,你知道你还可以用终端来做很多有趣的是吗?如果你不知道,没关系,大多数Linux用户也都只把终端视为一个用来管理系统和执行任务的交互接口。
|
||||
|
||||
然而,如果你知道这里有些你可以在终端玩的[基于终端的游戏][2]和[ASCII码游戏][3],你一定会大吃一惊。
|
||||
|
||||
在这篇文章中,我将会探索一些有趣的、可笑的、荒谬的命令来让你可以在终端中找点乐子!
|
||||
|
||||
### 用这些命令在Linux终端中找点乐子
|
||||
|
||||
![][4]
|
||||
|
||||
你可能会觉得这些命令荒谬或没用,但是有一些还是可以被好好利用的。
|
||||
|
||||
我已经添加了Ubuntu/Debian的安装组件,如果你使用基于Ubuntu的发行版,请确保[启用通用仓库][5]因为大多数命令不在主仓库中。
|
||||
|
||||
如果你使用Arch、Fedora、SUSE、Solus或者其他非Ubuntu的发行版,请使用你的发行版包管理工具去安装这些有趣的Linux命令。
|
||||
|
||||
#### 1\. 在终端开一辆火车
|
||||
|
||||
让我们坐上火车,来一场说走就走的旅行的,没错,就是字面意思!
|
||||
|
||||
sl命令可以让你在终端运行一辆火车。
|
||||
|
||||
![][6]
|
||||
|
||||
安装方法:
|
||||
|
||||
```
|
||||
sudo apt install sl
|
||||
```
|
||||
|
||||
完成后,你只要在终端输入下面的命令就可以开始
|
||||
|
||||
```
|
||||
sl
|
||||
```
|
||||
|
||||
很精彩,对吧?但等等,我们还没结束!你还可以让你的火车飞起来,只要加上参数-F,Magic:
|
||||
|
||||
```
|
||||
sl -F
|
||||
```
|
||||
|
||||
**这样会让火车长出翅膀飞出终端窗口!**
|
||||
|
||||
#### 2\. 给你的Linux终端加上矩阵效果
|
||||
|
||||
还记得科幻电影[黑客帝国][7]吗?掉落在终端的绿字变成一个矩阵符号。
|
||||
|
||||
你也可以在你的Linux电脑里有这样的矩阵数字雨!你只需要安装**cmatric**然后在终端输入它就行。
|
||||
|
||||
![][8]
|
||||
|
||||
在Debian/Ubuntu Linux上安装cmatrix:
|
||||
|
||||
```
|
||||
sudo apt install cmatrix
|
||||
```
|
||||
|
||||
现在,你要做的就是输入下面的命令,在终端就会有矩阵屏幕了:
|
||||
|
||||
```
|
||||
cmatrix
|
||||
```
|
||||
|
||||
按住Ctrl+C来停止它,黑客先生。
|
||||
|
||||
**推荐阅读:**
|
||||
|
||||
![][9]
|
||||
|
||||
#### [通过Telnet在Linux终端看星际大战][10]
|
||||
|
||||
在Linux终端看星际大战。
|
||||
|
||||
#### 3\. 让这里着火
|
||||
|
||||
拿好灭火器因为接下来你要在你的终端里点火了!
|
||||
|
||||
![][11]
|
||||
|
||||
想安装它,你要输入:
|
||||
|
||||
```
|
||||
sudo apt install libaa-bin
|
||||
```
|
||||
|
||||
完成后,你输入下面的命令,你的终端就会燃起一团火焰:
|
||||
|
||||
```
|
||||
aafire
|
||||
```
|
||||
|
||||
按住Ctril+C来停止它。
|
||||
|
||||
#### 4\. 幸运饼干命令
|
||||
|
||||
想知道你的运气怎样但身边没有幸运饼干?
|
||||
|
||||
别担心,你只需在终端打出“fortune”然后按下回车。终端将会显示出一个你的幸运语就像你从幸运饼干里得到的一样。
|
||||
|
||||
![][12]
|
||||
|
||||
安装它:
|
||||
|
||||
```
|
||||
sudo apt install fortune
|
||||
```
|
||||
|
||||
完成后,只要在命令行打出下面的内容,你就会知道你的运气怎样:
|
||||
|
||||
```
|
||||
fortune
|
||||
```
|
||||
|
||||
这是一个你可以实际去使用的命令。你可以用它作为每日消息,这样在多用户环境下,每个用户登录后都会得到一个“幸运饼干”。
|
||||
|
||||
你也可以把它添加到bashrc文件,这样当你登进终端你就会看到了。
|
||||
|
||||
#### 5\. 宠物爱好者?这是给你准备的
|
||||
|
||||
Oneko是一个有趣的命令,可以把你的光标变成一只老鼠,然后创造一只猫,一旦你移动光标,就会来追你。这不仅局限于终端。当猫追逐光标时,你可以继续工作。
|
||||
|
||||
如果你家里有孩子这一定很有趣。
|
||||
|
||||
![][13]
|
||||
|
||||
用下面的命令安装Oneko
|
||||
|
||||
```
|
||||
sudo apt install oneko
|
||||
```
|
||||
|
||||
用下面的命令运行它:
|
||||
|
||||
```
|
||||
oneko
|
||||
```
|
||||
|
||||
如果你不喜欢猫,喜欢狗,输入:
|
||||
|
||||
```
|
||||
oneko -dog
|
||||
```
|
||||
|
||||
这里有很多种小宠物,你可以用oneko -help获取信息。用Ctrl+C终止它。
|
||||
|
||||
#### 6\. 有个小兄弟在看着你
|
||||
|
||||
Xeyes是一个很小的GUI程序,它可以绘制出一双眼睛一直盯着你!它会不断跟随您的鼠标光标,运行命令自己看看!
|
||||
|
||||
![][14]
|
||||
|
||||
你可以用下面命令安装:
|
||||
|
||||
```
|
||||
sudo apt install xeyes
|
||||
```
|
||||
|
||||
然后这样用它:
|
||||
|
||||
```
|
||||
xeyes
|
||||
```
|
||||
|
||||
按住Ctrl+C终止它。
|
||||
|
||||
#### 7\. Let the terminal speak for you
|
||||
#### 7\. 让终端帮你讲话
|
||||
|
||||
打开你的扬声器,你来试试这个命令,[eSpeak][15]是一个有趣的命令,它可以让你的终端说话。是的,你没听错。
|
||||
|
||||
先安装这个包:
|
||||
|
||||
```
|
||||
sudo apt install espeak
|
||||
```
|
||||
|
||||
接下来,你只需要输入在命令行中输入你想听到的话:
|
||||
|
||||
```
|
||||
espeak "Type what your computer says"
|
||||
```
|
||||
|
||||
无论你在双引号里面填什么,你的电脑都会复述出来!它就像[在Linux中的echo命令][16],但不是打印出来,而是说出来。
|
||||
|
||||
#### 8\. 卫生间(但它不能洗衣服)
|
||||
|
||||
这听起来有点奇怪,是的。但是,这只是一个命令,用来将文本转换成大的ASCII字符。
|
||||
|
||||
![][17]
|
||||
|
||||
用这个命令安装toilet:
|
||||
|
||||
```
|
||||
sudo apt install toilet
|
||||
```
|
||||
|
||||
完成后,你只需输入:
|
||||
|
||||
```
|
||||
toilet sample text you want
|
||||
```
|
||||
|
||||
我也不知道为啥这个小程序叫卫生间。
|
||||
|
||||
#### 9\. 那个牛说什么?
|
||||
|
||||
Cowsay是一个在终端中用ASCII字符展示出一头牛的命令。通过这个命令,你可以控制牛说出你想说的话。
|
||||
|
||||
别纠结声音,它只展示文本(就是你看漫画书一样)。
|
||||
|
||||
![Cowsay Cowthink][18]
|
||||
|
||||
安装**cowsay**:
|
||||
|
||||
```
|
||||
sudo apt install cowsay
|
||||
```
|
||||
|
||||
安装完成后,你只要输入:
|
||||
|
||||
```
|
||||
cowsay "your text"
|
||||
```
|
||||
|
||||
无论你在双引号里填什么,你的牛都会说!我看到一些系统管理员用它来展示每天的消息。你也可以这样,你甚至可以把它和fortune命令结合。
|
||||
|
||||
#### 10\. Banner命令
|
||||
|
||||
banner命令与toilet命令相似,但它限制最多只能打印10个字符。
|
||||
|
||||
![][19]
|
||||
|
||||
你可以这样安装banner命令:
|
||||
|
||||
```
|
||||
sudo apt install sysvbanner
|
||||
```
|
||||
|
||||
然后这样运行:
|
||||
|
||||
```
|
||||
banner "Welcome"
|
||||
```
|
||||
|
||||
替换双引号里的内容,你将会得到你想要的展示内容。
|
||||
|
||||
#### 11\. Yes命令
|
||||
|
||||
![][20]
|
||||
|
||||
yes命令帮助你在循环中自动响应直到终止命令。这个命令将会一直打印相同的内容。如果你想快速生成大量垃圾文本,那么此命令将像超级按钮一样工作。
|
||||
|
||||
你也可以使用它为命令提供“yes”(如果提示)。例如,apt upgrade命令会要求你确认,你可以像这样使用它:
|
||||
|
||||
```
|
||||
yes | sudo apt upgrade
|
||||
```
|
||||
|
||||
你不需要安装任何包,Yes命令已经存在了。
|
||||
|
||||
想要终止yes命令循环,只需按住**CTRL+C**。
|
||||
|
||||
#### 12\. 得到一个新的身份
|
||||
|
||||
要生成一个随机的假身份吗?我推荐你用rig命令。你在终端运行它,就会生成一个假的身份。
|
||||
|
||||
![][21]
|
||||
|
||||
用这个命令安装rig:
|
||||
|
||||
```
|
||||
sudo apt install rig
|
||||
```
|
||||
|
||||
只需像这样输入:
|
||||
|
||||
```
|
||||
rig
|
||||
```
|
||||
|
||||
它可能被用在脚本或者web应用中展示随机信息,但我自己还没做过什么。
|
||||
|
||||
**结尾**
|
||||
|
||||
我希望你会喜欢这个有趣的Linux命令列表。你最喜欢哪个命令呢?你还知道其他有趣的命令吗?请在评论部分与我们分享。
|
||||
|
||||
![][22]
|
||||
|
||||
### Srimanta Koley
|
||||
|
||||
Srimanta是一位热情的作家、发行者、开源爱好者,非常喜欢与技术相关的所有内容。他喜欢读书,特别是90年的书!
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/funny-linux-commands/
|
||||
|
||||
作者:[Community][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Zioyi](https://github.com/Zioyi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/linux-command-tricks/
|
||||
[2]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[3]: https://itsfoss.com/best-ascii-games/
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fun-linux-commands.png?ssl=1
|
||||
[5]: https://itsfoss.com/ubuntu-repositories/
|
||||
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sl-command.jpg?ssl=1
|
||||
[7]: https://en.wikipedia.org/wiki/The_Matrix
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/matrix-screen-command.png?ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png?fit=732%2C462&ssl=1
|
||||
[10]: https://itsfoss.com/star-wars-linux/
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fire-command.png?ssl=1
|
||||
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fortune-command.jpg?ssl=1
|
||||
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/oneko-command.jpg?ssl=1
|
||||
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/xeyes-command.jpg?ssl=1
|
||||
[15]: https://itsfoss.com/espeak-text-speech-linux/
|
||||
[16]: https://linuxhandbook.com/echo-command/
|
||||
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/toilet-command.jpg?ssl=1
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cowsay-cowthink.jpg?ssl=1
|
||||
[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/banner-command.jpg?ssl=1
|
||||
[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/yes-yourtext.jpg?ssl=1
|
||||
[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/rig-command.jpg?ssl=1
|
||||
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/srimanta.jpg?ssl=1
|
Loading…
Reference in New Issue
Block a user