Your best source of information and news about Vista hardware , xp and windows on the internet Sua melhor fonte de informações e notícias sobre hardware Vista, XP e Windows na internet

Vista ARTICLES Vista ARTIGOS TOP 50 TOP 50 Spyware Virus Vírus Spyware Vista SOFT Vista SOFT Vista HELP Vista HELP

Using Autocompletion in Ubuntu Usando autocompletion no Ubuntu


The Tab key is your best friend when using the shell, because it will cause BASH to automatically complete whatever you type. A tecla Tab é a sua melhor amiga quando se utiliza a casca, porque vai causar BASH automaticamente para completar o que você digita. For example, if you want to run Ubuntu’s web browser, you can enter firefox at the command line. Por exemplo, se você deseja executar o navegador web do Ubuntu, você pode digitar firefox na linha de comando. However, to save yourself some time, you can type fir, and then press Tab. No entanto, para salvar-te algum tempo, você pode digitar abeto e, em seguida, pressione Tab. You’ll then find that BASH fills in the rest for you. Em seguida, você descobrir que BASH preenche o resto por si. It does this by caching the names of the programs you might run according to the directories listed in your $PATH variable. Isso é possível mediante a colocação em cache os nomes dos programas que você possa funcionar de acordo com os diretórios listados na sua variável $ PATH.

Of course, autocompletion has some limitations. Evidentemente, autocompletion tem algumas limitações. On my Ubuntu test system, typing loc didn’t autocomplete locate. Ubuntu no meu sistema de ensaio, digitando loc não autocomplete localizar. Instead, it caused BASH to beep. Em vez disso, ele causou BASH para apitar. This is because on a default Ubuntu installation, there is more than one possible match. Isso ocorre porque em uma instalação padrão Ubuntu, há mais de uma correspondência possível. Pressing Tab again shows those matches. Pressionar Tab mostra novamente esses jogos. Depending on how much you type (how much of an initial clue you give BASH), you might find there are many possible matches. Dependendo de quanto você digitar (que muito do que você dê uma pista inicial BASH), você pode encontrar possíveis muitas combinações.

In this case, the experienced BASH user simply types another letter, which will be enough to distinguish the almost-typed word from the rest, and presses Tab again. Neste caso, o usuário experiente BASH tipos simplesmente uma outra carta, o que será suficiente para distinguir o quase-palavra digitada a partir do repouso, e pressiona Tab novamente. With any luck, this should be enough for BASH to fill in the rest. Com alguma sorte, isto deveria ser suficiente para BASH para preencher o resto.


Autocompletion with Files and Paths Autocompletion com Ficheiros e Caminhos
Tab autocompletion also works with files and paths. Guia autocompletion também trabalha com arquivos e caminhos. If you type the first few letters of a folder name, BASH will try to fill in the rest. Se você digitar as primeiras letras de um nome de pasta, BASH tentará preencher o resto. This also obviously has limitations. Isso também tem, obviamente, limitações. There’s no point in typing cd myfol and pressing Tab if there’s nothing in the current directory that starts with the letters myfol. Não vale a digitando cd myfol e pressionando Tab se não existe nada no diretório atual que começa com as letras myfol. This particular autocomplete function works by looking at your current directory and seeing what’s available. Esta função funciona autocomplete particular, olhando para o seu diretório atual e vendo o que está disponível.

Alternatively, you can specify an initial path for BASH to use in order to autocomplete. Alternativamente, você pode especificar um caminho inicial para a utilização nas BASH fim de autocomplete. Typing cd /ho and pressing Tab will cause BASH to autocomplete the path by looking in the root directory (/). Se você digitar cd / ho e pressionando Tab fará com BASH para autocomplete, observando o caminho no diretório raiz (/). In other words, it will autocomplete the command with the directory home. Em outras palavras, ele irá ao command autocomplete com o diretório home. In a similar way, typing cd myfolder/myfo will cause BASH to attempt to autocomplete by looking for a match in myfolder. De um modo semelhante, digitando cd MinhaPasta / myfo BASH fará com que a tentativa de autopreenchimento pela procura de um jogo na MyFolder.

If you want to run a program that resides in the current directory, such as one you’ve just downloaded for example, typing ./, followed by the first part of the program name, and then pressing Tab should be enough to have BASH autocomplete the rest. Se quiser executar um programa que reside no diretório atual, tais como uma que você acabou de baixar, por exemplo, ao digitar. /, Seguido pela primeira parte do nome do programa e, em seguida, pressionando Tab deve ser suficiente para ter BASH autocomplete o resto. In this case, the dot and slash tell BASH to look in the current directory for any executable programs or scripts (programs with X as part of their permissions) and use them as possible autocomplete options. Neste caso, o ponto e dizer-slash BASH para procurar no diretório atual para quaisquer programas executáveis ou scripts (programas com X como parte de suas permissões) e utilizá-los como possíveis opções autocomplete.

BASH is clever enough to spot whether the command you’re using is likely to require a file, directory, or executable, and it will autocomplete with only relevant file or directory names. BASH é esperto o suficiente para detectar se o comando que você está usando é provável que exigem um arquivo, diretório ou executável, e ele irá autocomplete só com nomes relevantes arquivo ou diretório.


Viewing Available Options Exibindo opções disponíveis
The autocomplete function has a neat side effect. A função autocomplete tenha arrumado um efeito colateral. As we mentioned earlier, if BASH cannot find a match, pressing Tab again causes BASH to show all the available options. Como mencionado anteriormente, se BASH não pode encontrar uma correspondência, carregando novamente tabulação causas BASH para mostrar todas as opções disponíveis. For example, typing ba at the shell, and then pressing Tab twice will cause BASH to show all the possible commands starting with the letters ba. Por exemplo, ao digitar ba no reservatório e, em seguida, pressionando Tab duas vezes fará com BASH para mostrar todos os comandos possíveis começam com as letras ba. On my test PC, this produces the following list of commands: No meu teste PC, este produz a seguinte lista de comandos:

badblocks banner baobab basename bash bashbug batch badblocks banner baobá basename bash bashbug lote

This can be a nice way of exploring what commands are available on your system. Esta pode ser uma ótima maneira de explorar aquilo que os comandos disponíveis no seu sistema. You can then use each command with the --help command option to find out what it does, or browse the command’s man page. Você pode então usar cada comando com a opção - help comando opção para descobrir aquilo que faz, ou navegar na página man do comando.

When you apply this trick to directory and filename autocompletion, it’s even more useful. Quando você aplicar esse truque para autocompletion diretório eo nome do arquivo, ele é ainda mais útil. For example, typing cd in a directory, and then pressing the Tab key twice will cause BASH to show the available directories, providing a handy way of retrieving a brief directory listing. Por exemplo, digitando cd em um diretório e, em seguida, pressionando a tecla Tab duas vezes fará com BASH para mostrar os diretórios disponíveis, proporcionando uma maneira de recuperar um breve uma listagem do diretório. Alternatively, if you’ve forgotten how a directory name is spelled, you can use this technique to find out prior to switching into it. Em alternativa, caso você tenha esquecido como um diretório nome está escrito, pode usar essa técnica para saber antes de mudar para esta.

Source of Information : Apress Beginning Ubuntu Linux 3rd Edition Fonte de informação: Appress início Ubuntu Linux 3 ª edição

Popularity: 1% Popularity: 1%


Written by magakos. Escrito por magakos. Read more great feeds at is source Leia mais em grande feeds é fonte WEBSITE WEBSITE
no comments sem comentários . .
Read more articles on Leia mais artigos sobre Ubuntu Linux Ubuntu Linux and e otherSoftware otherSoftware . .

Related articles Artigos relacionados

No comments Sem comentários

There are still no comments on this article. Ainda não há comentários sobre este artigo.

Leave your comment... Deixe o seu comentário ...

If you want to leave your comment on this article, simply fill out the next form: Se quiser deixar o seu comentário sobre este artigo, simplesmente preencha o seguinte formulário:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . Você pode usar estes XHTML tags: <a href="" title="Avião"> <abbr title="Avião"> <acronym title="Avião"> <b> <blockquote cite=""> <code> <em> <i > <strike> <strong>.