source <(kubectl completion zsh) # 현재 셸에 zsh의 자동 완성 설정
echo "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> ~/.zshrc # 자동 완성을 zsh 셸에 영구적으로 추가한다.
흐음... 기본적으로 zsh 에. ohmyzsh 를 git 으로 clone 하여 설치하고 난뒤... '~/.oh-my...' 형태의 디렉토리가 존재하게 된다. 그 이하에 plugins 이라는 디렉토리에 ohmyzsh 플러그인들이 존재한다. 이걸 가동시키기 위해서는 ~/.zshrc 에서 plugin 항목에 공백을 구분자로 플러그인이름을 넣으면된다. 플러그인 이름은 플러그인 디렉토리에 있는 각 플러그인 디렉토리 안의 README 를 열어보면 나와있다.
여기서 ... 더 편하게 하기 위해 custom 플러그인을 하나 더 설치하면 좋다. 자동완성 플러그인인데
인데... 이렇게 하진 말고(왜냐면 ohmyzsh 를 git 으로 clone 해왔는데 그안에 또 하나의 git 을 clone 해오긴 싫다) 다른곳으로 위의 git 을 clone 해온뒤 $ZSH_CUSTOM/plugins/zsh-autosuggestions 위치에 ln 으로 링크 걸었다.
아무튼 그렇게 CUSTOM 위치에 링크걸고(ZSH_CUSTOM 이 환경설정으로 잡혀있는데 보면 CUSTOM 위치이다) .zshrc 를 수정한다.
You neglected to quote the \n passed to -d, which means that just n rather than \n was passed to xargs as the delimiter - the shell "ate" the \ (when the shell parses an unquoted string, \ functions as an escape character; if an ordinary character follows the \ - n in this case - only that ordinary character is used).
Also heed @glenn jackman's advice to double-quote the $@ inside the script (or omit the in "$@"part altogether).
Also: xargs -d is a GNU extension, which, for instance, won't work on FreeBSD/macOS. To make it work there, see @glenn jackman's xargs -0-based solution.
Note that I'm using printf rather than echo to ensure that the \n instances in the string are interpreted as newlines in all Bourne-like shells: In bash and ksh[1], echo defaults to NOT interpreting \-based escape sequences (you have to use -e to achieve that) - unlike in zsh and strictly POSIX-compliant shells such as dash. Therefore, printf is the more portable choice.
[1] According to the manual, ksh's echobuiltin exhibits the same behavior as the host platform's external echoutility; while this may vary across platforms, the Linux and BSD/macOS implementations do not interpret \ escape sequences by default.
xargs reads items from the standard input, delimited by blanks [...] or newlines
(emphasis mine)
Thus:
$ echo $'ac s\nbc s\ncc s\n'| xargs bash /tmp/test.sh
arg: ac
arg: s
arg: bc
arg: s
arg: cc
arg: s
DONE
$ printf "%s\0""ac s""bc s""cc s"| xargs -0 bash /tmp/test.sh
arg: ac s
arg: bc s
arg: cc s
DONE
With the former, you get the equivalent of
bash /tmp/test.sh ac s bc s cc s
versus using null-separator
bash /tmp/test.sh "ac s""bc s""cc s"
You need to be clear about what the delimiter is with xargs when the data contains whitespace.
$ printf "%s\n""ac s""bc s""cc s"| xargs -d $'\n' bash /tmp/test.sh
arg: ac s
arg: bc s
arg: cc s
DONE
$ echo $'ac s\nbc s\ncc s\n'| xargs -d $'\n' bash /tmp/test.sh
arg: ac s
arg: bc s
arg: cc s
arg:
DONE
Note the extra arg in the last case, echo already adds a newline, so you don't need an extra one unless you use echo -n
You're absolutely right: both issues need to be addressed to fix the problem (and they each in isolation or combination produce the symptom). Your printf-\0-xargs -0 solution is a nice alternative, because it is more portable (will work on OSX too, for instance, where xargs -d is not available). – mklement0Apr 17 '14 at 21:01
Also of interest is the ability of xargs to not run if stdin is empty: --no-run-if-empty-r : If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This option is a GNU extension. – Ronan JouchetOct 24 '15 at 19:58
This is the correct use of xargs. Without -n1, it only works on commands that treat lists of parameters as multiple invocations which not all do. – masterxiloMar 15 at 9:43
printf "foo bar\nbaz bat" | xargs -n1 echo whee splits by words and not by lines – Gismo RanasOct 24 at 8:32
I got a simple method to disable XFCE from this blog post: How to disable X at boot time in Ubuntu 11.10. Note: the post has a heading in some non-English language, possibly Portuguese, but the body of the post is in English.
With LightDM (lightdm) being the new graphical user login in Ubuntu, users will need to find a way to disable it to boot into text mode. Fortunately, the people behind LightDM have made that really easy to do.
Edit /etc/default/grub with your favorite editor,
sudo nano /etc/default/grub
Find this line:
GRUB_CMDLINE_LINUX_DEFAULT="<doesn’t matter what you find here>"
Change it to:
GRUB_CMDLINE_LINUX_DEFAULT="text"
Update Grub:
sudo update-grub
No need to remove / disable LightDM upstart conf; it already does that for you.
lightdm.conf
# Check kernel command-line for inhibitors, unless we are being called manually.
for ARG in $(cat /proc/cmdline); do
if [ "$ARG" = "text" ]; then
plymouth quit || :
stop
exit 0
fi
done
You will still be able to use X by typing startx after you logged in.
파일시스템의 구현상으 특징같은데, 아무튼 exFat 으로 포맷한 하드에서 파일을 삭제했을때(in archilinux? ) 실제 free 용량이 늘어나지 않는 점을 발견했다. ... 근데 이게 ... 시간이 좀 지나서? 리부팅? 아무튼 좀 있다보면 남은용량이 제대로 적용되어 있다.(df 로 확인)
검색해보니, 자세히 기억나진 않지만, 시스템이 알고 있는 남은용량과 실제 남은용량을 맞춰주면 이 이슈는 해결된다고 한다.
tune2fs -m 0 /dev/sda1
해서 용량을 정상화 할 수 있었다. (워워 .. 뒤의 파라미터중 실제 하드 파티션은 자신의 것에 맞게 수정하라. 모르겠다면 mount 명령으로 dev 의 어느것과 연결된건지 확인가능하다)
\n
passed to-d
. – mklement0 Apr 17 '14 at 20:47printf
-\0
-xargs -0
solution is a nice alternative, because it is more portable (will work on OSX too, for instance, wherexargs -d
is not available). – mklement0 Apr 17 '14 at 21:01