开发人员的50个Linux资源
使用你的 Linux 系统
下面是一些设置和使用你的Linux系统每天的日常任务的基础知识。
初学者
How to: Change / Setup bash custom prompt (PS1) - Information on how to customize the bash prompt (the “$” or “bash@host $” next to your cursor in your terminal). You can have it include the date and time, your username, the hostname, change the colors of it, and more.
Bash tips: Colors and formatting - This goes pretty in-depth into customizing the colors displayed in your bash prompt.
AptGet HowTo - This guide from Ubuntu explains how to use the APT package manager to install packages to your system, update them, and more.
Command Line Fu - This site has hundreds of tips on how to do various things from the Linux command line. You can browse by searching for specific commands, or by looking at the most popular ones over time.
Bro Pages - Instead of giving a lot of dense documentation like a full man page, Bro gives simple real-world examples for common commands.
高级
Learn Linux the Hard Way - Challenges that are intended to help you learn Linux with real examples, and memorize the commands you will use over and over. To do these, you will need to set up a VM so that you don’t break anything on your current system.
Creating a Mail Server on Ubuntu - This post describes the process of setting up Postfix and Courier on your server to securely handle your mail. Very in-depth. You can also supplement this with this guide which contains a lot of the same information, but which is also more thorough. I would specifically recommend following their instructions for setting up users’ passwords, as they use SHA-256 instead of MD5, which is used in the first guide.
Better Bash Scripting in 15 Minutes – Some excellent tips and tricks for writing bash scripts.
Bash Prompt HOWTO – A very in-depth guide to customizing your command prompt.
Explainshell – Ever had a long command that you wanted to understand better? Explainshell will take in commands and print out only the relevant documentation so that you don’t have to dig through a bunch of man pages.
Oh My Zsh - zsh (Z shell) is a shell like bash, with a few more features like vi mode, the ability to create functions. Oh My Zsh is a package of plugins and themes for enhancing zsh.
An introduction to the Z shell - Documentation explaining the basics of using Z shell, and its differences from bash.
A tmux Tutorial and Primer - Describes some of the basic usage of tmux, a program that is helpful for managing remote sessions, dividing up your terminal workspace, and displaying useful status information.
SSH Kung Fu – Use SSH like a pro: as a proxy, as an encrypted tunnel, to remotely edit files with Vim, and more.
保护和监控你的Linux系统
这些链接是有关如何保护Linux服务器从外部攻击。它们包括如何设置防火墙提示,锁定SSH等。
初学者
Securing a Linux Server - This appropriately-named post has lots of useful tips, like how to set up SSH key login, setup a firewall (iptables), install fail2ban to prevent hacking attempts, and more.
My First 5 Minutes On A Server; Or, Essential Security for Linux Servers - This post has some of the same information as the one above, but it has some additional tips, like setting up logwatch and setting up automatic updates in Ubuntu.
20 Linux System Monitoring Tools Every SysAdmin Should Know - A great list of many tools that you can use to check what resources processes are using, who’s logged in, and much more.
20 Iptables Examples for New SysAdmins - Some examples for how to use iptables effectively, including blocking IP addresses, limiting the number of connections per IP, and more.
高级
SANS Institute Linux Security Checklist - A checklist of common security settings, including locking down your password file (/etc/passwd) and others, setting up backups, and setting a password complexity/reset policy.
The Linux System Administrator’s Guide - This guide goes pretty in-depth into all the different aspects of running a server from a SysAdmin’s point of view, including information about system directories like /etc/ and /proc/, managing users, and more.
Linux Kernel /etc/sysctl.conf Security Hardening - This has information on how to lock down the TCP/IP stack & virtual memory in Linux using sysctl. Some topics mentioned are how to prevent a SYN flood attack, enabling source IP verification, and logging suspicious packets. Here is a list of many sysctl variables you can tweak around IPv4.
IptablesHowTo - This page from Ubuntu has lots of information about how to set up and maintain iptables, including setting up rules and reloading them on reboot. It includes some links at the bottom with much more in-depth information (Like Iptables Tutorial 1.2.2).
Top 20 Nginx WebServer Best Security Practices - Here you will learn how to lock down nginx, a very popular webserver. Includes guides on how to remove some unwanted modules, control buffer overflow based attacks, and more.
Tougher SSL security in nginx – A short guide on improving the security of SSL/TLS in nginx, including disabling SSL in favor of TLS, and forcing clients to use secure ciphers.
Mitigating DoS Attacks with a null route - Information on how to null route IPs to mitigate Denial of Service attacks.
Sysdig - Utility that combines functionality from lots of different monitoring tools into a single, easier-to-use interface. It can monitor network traffic, I/O traffic, performance, errors, security, and CPU & memory usage.
Writing snort rules – The official manual for writing rules for snort, an intrusion detection system for Linux. This will help you detect and mitigate attacks on your system. This page has options for paid and free collections of ready-made snort rules.
The Most Common OpenSSL Commands - OpenSSL is a widely-used library for working with SSL and TLS connections, and it comes packaged with the OpenSSL utility that lets you generate RSA keys & SSL certificate signing requests, debug SSL connections, and convert keys/certs between different formats.
使用 Vim
While I’m sure many today would argue that they have no need for using a terminal-based text editor, I’m inclined to disagree. I work with different servers a lot, and I find that it’s a pain to constantly edit files on my machine and upload them to whatever server I’m working on with scp or similar. As such, I highly recommend putting in the effort to learn Vim. It is included on virtually every Linux installation in existence, and its plugins make it infinitely extensible. I’ve included links to several plugins I quite like, and some games, tutorials, and cheat sheets to help get started using Vim. It has a heavy up-front cost, but in the long run I feel it is well worth it.
Beginner
VIM Adventures – This is a fun game that you can use to master the basics of Vim. You perform various vim functions to move a character around a game board of sorts. This is particularly useful for building up your muscle memory for common commands.
vim:essentials – Some of the most commonly used command combinations in Vim.
Vi Cheat Sheet - This page has a great list of all the basic commands you’ll use over and over again in Vim.
IRC Based Vim tutorial - This is a Vim tutorial placed into the narrative of an IRC conversation between Socrates and Glaucon, his student. It’s an interesting read, and gives you practical knowledge for real-world situations.
Advanced
Vimgolf – This site has challenges for performing various text editing functions with the fewest number of keystrokes. This is great practice for thinking about how to save time when using Vim.
Vim Regular Expressions – This site has lots of detailed information about using regular expressions to find and replace text strings in Vim. This is one of the real workhorses of Vim.
vi Complete Key Binding List - A list of all the keys that are commonly bound to commands in vim. This is useful for finding functions you weren’t aware of, or if you want to bind keys to your own functions, and don’t want to overwrite anything that’s currently in place.
以下是一些值得收藏的Vim插件
Pathogen – While there are other Vim package managers out there, I love the simplicity of setting up a plugin with Pathogen, and it just works. Tim Pope actually makes lots of other great Vim plugins too. You can install all of the plugins below with Pathogen.
Fugitive - A git wrapper for Vim (also by Tim Pope) that allows visual diffing, and makes doing other git commands from Vim much easier than using ! or :sh.
NERD tree - A plugin to let you easily list directories and their contents with color highlighting, open files in new tabs, and much more.
Conque - A plugin to let you run shell commands from Vim, by splitting the current window or opening an interactive shell in a new tab.
Easy Motion - This plugin lets you move around in Vim like magic. By hitting the Easy Motion key twice, and then using regular Vim movement commands, you will see all the possible places that that motion could take you, and you can select them by simply typing the highlighted letter that appears where you want to go. If that sounds confusing, go check out the page for examples.
Vim Colorschemes – A huge list of color schemes that you can use in Vim. You can find many of them on the vim color scheme test, where you can preview HTML or C code in many themes.
Vim Multiple Cursors - This will let you select a word, and then by using a key combination that you bind, you can select other instances of that word and edit them all simultaneously, much like the “Command-D” keystrokes in Sublime Text 2.
杂项
Here are some random resources for developers that didn’t fit cleanly into my other categories.
Bentobox – Tutorials, guides, and reference material on topics like the Linux shell, programming languages, Vim, databases, and much more.
More Git and Github Secrets - Slides and a video diving into various little-known secrets about the Git version control system.
Gitlab Installation Instructions - Gitlab is an open source web frontend for Git, similar to Github.com. It has features like web hooks, LDAP user auth, snippets, and more.
Using the nginx HTTP upstream module – This reference from nginx.org has information on how to use nginx to set up round-robin loadbalancing.
Vimium – Once I got hooked on Vim, I found myself using the movement keys in Chrome with no success. Enter Vimium, a Chrome extension that lets you do many of the cool things you can do with Vim, like searching for regular expressions and moving using the familiar Vim macros.
7 command-line tools for data science - This page has information about different command-line tools that help with Obtaining, Scrubbing, Exploring, Modeling, and iNterpreting data (OSEMN – pronounced ‘awesome’). This includes tools for dealing with JSON data, manipulating CSV files, scraping HTML and more. It also contains a link to an article listing standard UNIX tools useful to data science, like head, wc, and sed.
Run Node.js as a Service on Ubuntu - If you’ve ever played around with Node.js and wondered how to run it as a more robust service, this is for you.
Powerline – This is a plugin for Vim that also has bindings for bash, zsh, and tmux, that creates a visually appealing status line that is highly customizable, including color schemes and different prompts/bars for different applications.