0Pricing
Linux Command Line Mastery · Aula

Criando e Seguindo Links Simbólicos

Aprenda a criar, inspecionar e gerenciar links simbólicos e físicos para organizar arquivos com flexibilidade, sem copiar dados.

Criando e Seguindo Links Simbólicos é uma aula grátis de Linux Command Line Mastery no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Linux Command Line Mastery, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Linux Command Line Mastery inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

What Is a Link

A link is a filesystem entry that points to another file. Links let one file appear in multiple places without duplicating its data, saving space and easing organization.

Linux has two kinds: symbolic links and hard links.

Creating a Symbolic Link

A symbolic link (symlink) is a small file holding a path to its target. Create one with ln -s: the target first, then the link name.

ln -s /var/log/app.log current.log

Inspecting Links

ls -l shows symlinks with an arrow pointing to their target, and the type character l at the start of the permissions.

ls -l current.log
# lrwxrwxrwx 1 user user 16 ... current.log -> /var/log/app.log

Following a Link

Reading or writing through a symlink transparently affects the target. Editing current.log edits /var/log/app.log.

cat current.log   # reads the target file's contents

Hard Links

A hard link is a second name for the exact same data on disk. Both names are equal; deleting one leaves the data until the last link is gone.

ln original.txt backup.txt   # no -s means hard link

Symbolic vs Hard

Key differences:

  • Symlinks can cross filesystems and link directories; hard links cannot.
  • A symlink breaks if its target moves; a hard link keeps the data alive.
  • Symlinks store a path; hard links share an inode.

Broken Links

If a symlink's target is deleted or moved, the link becomes dangling. Accessing it fails. ls often shows broken links in red.

rm /var/log/app.log
cat current.log   # error: No such file or directory

Finding the Target

Use readlink to print where a symlink points, and readlink -f to resolve the full real path through chained links.

readlink current.log
readlink -f current.log

Updating and Removing Links

To repoint a symlink, use ln -sf to force-replace it. To remove a link, rm deletes the link itself, never the target file.

ln -sf /var/log/new.log current.log   # repoint
rm current.log                        # remove the link only

Practical Uses

Symlinks shine for:

  • A stable current path pointing at the latest versioned release.
  • Putting config files in a dotfiles repo, linked into $HOME.
  • Sharing a dataset across projects without copies.

Listing All Links in a Directory

To audit existing links, combine ls with a filter. The find command can list every symlink under a path, helping you spot broken or stray ones.

find . -type l

Quick Check

Test your understanding of links.

Recap

You learned to work with links: create symlinks with ln -s, inspect them with ls -l and readlink, understand hard vs symbolic differences, recognize broken links, repoint with ln -sf, and apply them to releases, dotfiles, and shared data.

Perguntas Frequentes

A aula “Criando e Seguindo Links Simbólicos” é grátis?

Sim — o texto completo de “Criando e Seguindo Links Simbólicos” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Linux Command Line Mastery, atualize para CoddyKit PRO. O curso de Linux Command Line Mastery inclui 4 aulas no total.

O que vou aprender em “Criando e Seguindo Links Simbólicos”?

Aprenda a criar, inspecionar e gerenciar links simbólicos e físicos para organizar arquivos com flexibilidade, sem copiar dados. Você pratica Linux Command Line Mastery com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Linux Command Line Mastery?

Nenhuma experiência prévia é necessária. Linux Command Line Mastery no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Criando e Seguindo Links Simbólicos”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Linux Command Line Mastery?

Sim. Cada aula de Linux Command Line Mastery inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Visualização do conteúdo de arquivos: `cat`, `less`, `more`
  2. Pesquisa de arquivos: `find` e `locate`
  3. Permissões e propriedade: `chmod`, `chown`
  4. Criando e Seguindo Links Simbólicos
← Voltar para Linux Command Line Mastery