Thomas Limoncelli - Time Management for System Administrators
Здесь есть возможность читать онлайн «Thomas Limoncelli - Time Management for System Administrators» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Старинная литература, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Time Management for System Administrators
- Автор:
- Жанр:
- Год:неизвестен
- ISBN:нет данных
- Рейтинг книги:4 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 80
- 1
- 2
- 3
- 4
- 5
Time Management for System Administrators: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Time Management for System Administrators»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Time Management for System Administrators — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Time Management for System Administrators», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
Command Shortcuts
Most command-line systems have some kind of alias facility. This enables you to create new commands out of old ones. The syntax is different for every kind of command line. Unix has many different shell (command-line) languages, the most popular being bash and csh . They are different in many ways, but what you'll notice here (mostly) is that bash requires an equals sign. I'll give examples for both shells.
Tip
The bash examples will work for any shell modeled after the original Bourne Shell by Steve Bourne (/bin/sh), such as the Korn Shell (/bin/ksh), and the Z Shell (/bin/zsh). Likewise, the csh examples will work for any shell with csh roots, including the Tenex C shell (/bin/tcsh).
Getting to the right directory
For example, I often need to change directory (cd) to a specific directory that has a very long path. This is a good example of where an alias is useful.
Bash: alias book='cd ~tal/projects/books/time/chapters'
csh: alias book 'cd ~tal/projects/books/time/chapters'
Now I can type bookwhenever I want to be in the right directory for working on my current book. If I start working on a new book, I update the alias. (I've been typing "book" for the last six or so years!)
This not only saves typing, it records the location so that you don't have to memorize it. One less thing that you have to remember is always a good idea.
To make an alias permanent, you have to add the above line to your .profile , .bashrc (bash), or .cshrc file (csh). These files are only read at login, so either log out and log back in, or source the files to read them in again:
Bash: . ~/.profile
csh: source ~/.cshrc
(Note: the bash command to source a file is the period, or dot.)
An alias can contain multiple commands. Separate them with semicolons. Here's an example where we need to change to a particular directory and set an environment variable based on whether we're using the A system or the B system:
Bash: alias inva='cd ~tal/projects/inventory/groupa ; export INVSTYLE=A' alias invb='cd ~tal/projects/inventory/groupb ; export INVSTYLE=B'
csh: alias inva 'cd ~tal/projects/inventory/groupa ; setenv INVSTYLE A' alias invb 'cd ~tal/projects/inventory/groupb ; setenv INVSTYLE B'
Instead of using a semicolon, use && to indicate "Do this next command only if the first one succeeded." This can be useful to protect against running a command while in the wrong directory. For example, you want to go to a particular directory and write a timestamp to a logfile. However, if the cd fails (the server is unavailable), you don't want to accidentally create a logfile in your current directory.
Bash: alias rank='cd /home/rank/data && date >>.log'
csh: alias rank 'cd /home/rank/data && date >>.log'
Warning
Don't try to turn one OS into another. Aliases are great, but don't overdo it. I've often seen people developing dozens of aliases so that they can type DOS commands in Unix. I think this is a bad idea. You're never going to learn Unix that way, and the next time you are on someone else's machine and don't have access to those aliases, you'll be stuck.
Hostname Shortcuts
If there are particular hostnames you type over and over, you can save some time by creating aliases. For example, if you are often dealing with a machine called ramanujan.company.com, you can create an alias (a DNS CNAME record) called ram.company.com. That's a little less typing.
The problem with this technique is that it can become a maintenance nightmare. If people start to depend on both names, you're stuck maintaining both names. So how can you create an alias that only you know about that won't bother other people?
Typically, if there is a machine I access a lot, I'm accessing it almost exclusively via Secure SHell (SSH). SSH is a secure (encrypted) replacement for telnet and rsh . You can also use it to copy files ( scp , a replacement for rcp ), and many programs, such as rsync , use SSH. Unix SSH (OpenSSH and its brothers) lets you set up host aliases for all users on a Unix machine or aliases that are private for you.
To affect only your SSH sessions, add aliases to the ~/.ssh/config file. To affect all users of the system, add aliases to either /etc/ssh_config or /etc/ssh/ssh_config , depending on how your system was configured. In this example, I create an alias, es, so that I don't have to type www.everythingsysadmin.com all the time: Host es HostName www.everythingsysadmin.com
Not only can I use ssh es where I used to type ssh www.everythingsysadmin.com , but the alias works for all SSH-related commands: scp , sftp , rsync , and so on. In fact, scripts and programs that I can't change will automatically pick up these settings. Some examples: $ ssh es$ scp file.txt es:/tmp/$ rsync ex:/home/project/alpha ~/project/alpha
I need to use ssh es so often that I actually created a shell alias to reduce my typing further:
Bash: alias es='ssh es'
csh: alias es 'ssh es'
The result is that I can now type es on the command line to log into the machine, or I can use es to refer to the machine when using scp or rsync . Same two letters either way. Cool, huh?
It is tempting to create two-letter aliases for every server in the world. However, you will soon find yourself spending more time remembering your coding system than using it. Personally, I limit myself to a few common machines that I access via SSH.
The ssh_config(5) manpage lists many other configuration options. For example, there is one machine that I occasionally access that requires a very specific combination of options on the command line. (It's a home-grown version of the SSH server that not only doesn't implement all the features but gets confused if you try to negotiate anything it doesn't understand.) The command I have to type to get it just right is: $ ssh -x -o RSAAuthentication=yes -o PasswordAuthentication=yes -o ChallengeResponseAuthentication=no -1 peter.example.net
I could have set up a shell alias, but instead I can modify the SSH configuration, and all systems that use SSH will do the right thing. If a script that I can't modify uses SSH to reach that machine, these settings will still be used.
The lines in my ~/.ssh/config file look like this: Host peter.example.net ForwardX11 no RSAAuthentication yes PasswordAuthentication yes ChallengeResponseAuthentication no Compression no Protocol 1
SSH clients for Windows tend to have a GUI that will let you save profile settings to be used for a particular host or hosts.
The more you learn about SSH, the more you can do with it. There are many good books and online tutorials on the finer points of SSH, such as SSH, The Secure Shell: The Definitive Guide (O'Reilly). If there is one thing every system administrator should, but may not, know about SSH, it is how to set up public/private keys to securely eliminate the need to type passwords when SSHing from one specific machine to another.
A Makefile for Every Host
This section applies to Unix/Linux systems. Windows folks might want to skip it.
Unix/Linux systems often maintain critical information in plain text files that are edited by hand. Sometimes, after editing a file, you have to run a command to inform the system that the information has changed.
SSH to the Right Server in a Web Farm Every Time
Suppose you have three servers: server1.example.com , server2.example.com , and server3.example.com . You have many web sites divided among them, and remembering which site is on which server is getting to be a drag. Is www.everythingsysadmin.com on server 1 or 3? You think it's on 3, but someone may have moved it to 2 when you ran low on disk space. Why try to remember at all? No need to set up a configuration file, just SSH to the web site's hostname! For example, type sshwww.everythingsysadmin.com and soon you'll find yourself on the right machine. OK, that's pretty obvious, but you'd be surprised how often people forget that it works!
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Time Management for System Administrators»
Представляем Вашему вниманию похожие книги на «Time Management for System Administrators» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Time Management for System Administrators» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.