1. Count the number of files in the/usr/bin directory
[Email protected] ~]# Ls/usr/bin | Wc-l1306[[email protected] ~]# |
2. Remove the shell of all users on the current system, requiring that each shell be displayed only once, and displayed sequentially
[Email protected] ~]# cut-d:-f7/etc/passwd | Sort-u/bin/bash/bin/nologin/bin/sync/bin/tcsh/sbin/halt/sbin/login/sbin/nologin/sbin/shutdown[[email protected] ~]# |
3. Thinking: How to display the content type of each file in the/var/log directory?
[Email protected] ~]# file/var/log/*/var/log/acpid: ASCII text/var/log/anaconda.log: ASCII 中文版 text, With very long lines/var/log/anaconda.syslog: ASCII 中文版 text/var/log/anaconda.xlog: ASCII Chinese text/ Var/log/audit: directory/var/log/boot.log: empty/var/log/boot.log.1: empty/var/log/boot.log.2: empty/var/log/boot.log.3: empty/var/log/boot.log.4: Empty |
4. Remove the 6th line of the/etc/inittab file
[Email protected] ~]# head-6/etc/inittab## inittab This file describes how the INIT process should set up# the System in a certain run-level.## Author: Miquel van Smoorenburg, <[email protected]># Modified for RHS Linux by Marc Ewing and Donnie barnes[[email protected] ~]# head-6/etc/inittab | tail-1# Modified for RHS Linux by Marc Ewing and Donnie barnes[[email protected] ~]# |
5. Remove the user name and shell of the 9th user in the/etc/passwd file, display it to the screen and save it to the/tmp/uses file
[[email protected "~]# tail-9/etc/ passwdzhangfengzhe10:x:1102:1102::/home/zhangfengzhe10:/bin/bashzhangfengzhe11:x:1103:1103::/home/ ZHANGFENGZHE11:/SBIN/NOLOGINZHANGFENGZHEFORSYS:X:101:102::/HOME/ZHANGFENGZHEFORSYS:/BIN/BASHTEST1:X:1104:1104: :/home/test1:/bin/bashmandriva:x:4004:3004::/home/mandriva:/bin/bashfedora:x:2003:2003:fedora Commnuity:/home/ Fedora:/bin/tcshhbase:x:102:103::/home/hbase:/bin/nologinopenstack:x:4005:4005::/home/openstack:/bin/bashhive: X:5000:5000::/home/hive:/bin/bash[[email protected] ~]# tail-9/etc/passwd | Head-1zhangfengzhe10:x:1102:1102::/home/zhangfengzhe10:/bin/bash[[email protected] ~]# tail-9/etc/passwd | head-1 | cut-d:-f1,7zhangfengzhe10:/bin/bash[[email protected] ~]# tail-9/etc/passwd | head-1 | Cut-d:-f1,7 | Tee/tmp/userszhangfengzhe10:/bin/bash[[email protected] ~]# Cat/tmp/userszhangfengzhe10:/bin/bash[[email protected] ~]# |
6. Show all files starting with PA in/etc directory and count them
[[email protected] ~]# ls-ld/etc/pa*/drwxr-xr-x 2 root root 4096 Mar 5 2012/etc/pam.d/drwxr-xr-x 2 root root 40 2011/etc/pam_pkcs11/drwxr-xr-x 3 root root 4096 2011/etc/pango/[[email protected] ~]# ls-ld/e tc/pa*/| Wc-l3[[email protected] ~]# |
7. Add the alias Cls=clear line to the current user's. bashrc file without using a text editor
[Email protected] ~]# echo "Alias cls= ' Clear '" Alias cls= ' Clear ' [[email protected] ~]# Echo ' Alias cls= ' clear ' >> ~ /.bashrc[[email protected] ~]# tail-1 ~/.bashrcalias cls= ' Clear ' [[email protected] ~]# tail ~/.bashrcalias cp= ' cp-i ' Alias mv= ' mv-i ' # Source global definitionsif [-F/ETC/BASHRC]; Then ./etc/bashrcfialias cls= ' Clear ' [[email protected] ~]# |
Important philosophical ideas of Linux:
Combine small commands to complete complex functions.
This article is from the "I want to surpass myself" blog, please be sure to keep this source http://zhangfengzhe.blog.51cto.com/8855103/1413214