暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

输出重定向-UOS

原创 默默 2022-07-22
352

实验-输出重定向
echo uos > test
cat test
echo bing > test
cat test
echo txuos >> test
cat test

实验-错误重定向
wadwadwad 2> test
cat test

实验-双重输出重定向
find / -user uos > test
cat test
find / -name passwd 2> test
cat test
find / -name passwd &> test
cat test

find / -name passwd > test 2>&1
cat test

实验-输入重定向
mail uos < test
su - uos
mail

cat > ok << EOF
123
456
EOF
cat ok

实验-管道
cat /etc/passwd | grep root
cat /etc/passwd | grep ^root
cat /boot/grub2/grub.cfg | grep -v ^# | grep -v ^$ > newgrub
cat /boot/grub2/grub.cfg | tee file1 | grep -v ^# | tee file2 | grep -v ^$ | tee file3 > newgrub

实验-文件操作命令
head /etc/passwd
head -n 5 /etc/passwd
tail /etc/passwd
tail -n 5 /etc/passwd
tail -f /var/log/message
wc -l /etc/passwd
sort -rnk 3 -t : /etc/passwd
uniq -c qintest
uniq -c qintest | sort
sort qintest | uniq -c
df -Th | grep sda2 | tr -s " " | cut -d " " -f 6 | cut -d "%" -f 1
paste file1 file2 file3

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论