방금 실행 파일을 만들었습니다.
ln -s /path/to/script.sh /bin/script
그런 다음 모든 것이 성공했는지 확인하고 실제로 /bin/script
성공했는지 확인합니다.하지만 그것은 또한 창조한다:
/usr/bin/script
시스템 사용량을 확인하기 위해 script
명령을 사용 which
하면 /usr/bin/script
.
링크는 다음과 같습니다.
2370517 0 lrwxrwxrwx. 1 root root 32 Jun 26 15:48 /bin/script -> /home/username/Scripts/script.sh
2370517 0 lrwxrwxrwx. 1 root root 32 Jun 26 15:48 /usr/bin/script -> /home/username/Scripts/script.sh
질문:
주어진 명령을 따르지 않고 두 번째 링크를 생성하는 이유는 무엇입니까?
이 심볼릭 링크를 만들기 전에 다음 명령이 존재하는지 확인했습니다.
which script
/usr/bin/which: no script in (/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/usr/lib64
/alliance/bin:/usr/libexec/sdcc:/home/username/.local/bin:/home
/username/bin:/usr/lib64/alliance/bin:/usr/libexec/sdcc:/usr/lib64
/alliance/bin:/usr/libexec/sdcc)
편집 #1
추가 정보를 요청하는 의견을 토대로:
$df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 4067656 0 4067656 0% /dev
tmpfs 4079452 7876 4071576 1% /dev/shm
tmpfs 4079452 960 4078492 1% /run
tmpfs 4079452 0 4079452 0% /sys/fs/cgroup
/dev/mapper/fedora_hostname-root 4674688 78624 4335560 2% /
/dev/mapper/fedora_hostname-usr 98874972 13540704 80288612 15% /usr
/dev/sdb2 369639 168512 177524 49% /boot
/dev/mapper/fedora_hostname-var 6597808 1523556 4716060 25% /var
/dev/mapper/fedora_hostname-opt 23901328 630808 22033324 3% /opt
/dev/mapper/fedora_hostname-tmp 9480420 21592 8954204 1% /tmp
/dev/mapper/fedora_hostname-home 81412840 5154748 72099424 7% /home
/dev/sda2 453437944 19435724 410945836 5% /MOUNT1
/dev/sda1 1469159772 1182245732 212261988 85% /MOUNT2
tmpfs 815892 36 815856 1% /run/user/1000
tmpfs 815892 0 815892 0% /run/user/0
$cat /proc/self/mounts
sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=4067656k,nr_inodes=1016914,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
tmpfs /sys/fs/cgroup tmpfs ro,seclabel,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/mapper/fedora_hostname-root / ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/fedora_hostname-usr /usr ext4 rw,seclabel,relatime,data=ordered 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=28,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
/dev/sdb2 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/fedora_hostname-var /var ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/fedora_hostname-opt /opt ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/fedora_hostname-tmp /tmp ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/fedora_hostname-home /home ext4 rw,seclabel,relatime,data=ordered 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/dev/sda2 /MOUNT\0401 ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/sda1 /MOUNT\0402 ext4 rw,seclabel,relatime,data=ordered 0 0
tmpfs /run/user/1000 tmpfs rw,seclabel,nosuid,nodev,relatime,size=815892k,mode=700,uid=1000,gid=1000 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=815892k,mode=700 0 0
편집 #2
요청 시 추가 정보:
$/bin/ls -ld /bin /usr/bin
lrwxrwxrwx. 1 root root 7 Nov 18 2014 /bin -> usr/bin
dr-xr-xr-x. 3 root root 135168 Jun 26 15:48 /usr/bin
답변1
미래에 오신 것을 환영합니다. 지금은 2012년이고 새로운 Fedora 버전 17에는 별도의 디렉토리 /bin
가 없습니다 . /usr/bin
/bin
추가 읽기
- 조 "존커" 브록마이어(2012-01-30).끊임없이 변화하는 Linux 파일 시스템: 디렉토리를 /usr로 병합. linux.com.
- Harald Høyer와 Kay Sievers(2012). 사용자 움직임. 페도라 프로젝트.