cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:command:ln.html



ln and unlink - How to use ln and unlink command in Linux with examples

Example

Successful operation

[kurihara@centos7 tmp]$ echo aaa > org
[kurihara@centos7 tmp]$ cat org
aaa
[kurihara@centos7 tmp]$
-rw-rw-r-- 1 kurihara kurihara  0 Jun 20 23:36 org
[kurihara@centos7 tmp]$ ln -s org det
[kurihara@centos7 tmp]$ ls -lh
lrwxrwxrwx 1 kurihara kurihara  3 Jun 20 23:36 det -> org
[kurihara@centos7 tmp]$ cat org
aaa
[kurihara@centos7 tmp]$
[kurihara@centos7 tmp]$ cat dst
aaa
[kurihara@centos7 tmp]$ unlink det
[kurihara@centos7 tmp]$ ls -lh
-rw-rw-r-- 1 kurihara kurihara  0 Jun 20 23:36 org
[kurihara@centos7 tmp]$ 


Failed operation

[kurihara@centos7 tmp]$ echo aaa > org
[kurihara@centos7 tmp]$ cat org
aaa
[kurihara@centos7 tmp]$
-rw-rw-r-- 1 kurihara kurihara  0 Jun 20 23:36 org
[kurihara@centos7 tmp]$ ln -s org det
[kurihara@centos7 tmp]$ ls -lh
lrwxrwxrwx 1 kurihara kurihara  3 Jun 20 23:36 det -> org
[kurihara@centos7 tmp]$ unlink org
[kurihara@centos7 tmp]$ ls -lh
lrwxrwxrwx 1 kurihara kurihara  3 Jun 20 23:44 dst -> org
[kurihara@centos7 tmp]$ cat dst
cat: dst: No such file or directory
[kurihara@centos7 tmp]$ cat org
cat: org: No such file or directory
[kurihara@centos7 tmp]$



os/linux/command/ln.html.txt ยท Last modified: 2019/06/20 by admin

Page Tools