Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the liunx problem

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article analyzes "how to solve the liunx problem". The content is detailed and easy to understand. Friends who are interested in "how to solve the liunx problem" can follow the editor's idea to read it slowly and deeply. I hope it will be helpful to you after reading. Let's learn more about "how to solve liunx problems" with the editor.

1. Check out line 6 of the / etc/inittab file:

Head-6 / etc/inittab | tail-1

2. Take out the username and shell of the penultimate user in the / etc/passwd file, display it on the screen, and save it to the / tmp/users file:

Tail-9 / etc/passwd | head-1 | cut-d:-F1 tmp/users 7 | tee / tmp/users 3, display all files that begin with pa in the / etc directory, and count the number of them.

Ls-d / etc/pa* | wc-l

4. If the text editor is not applicable, add one line of alias cls = clear to the current user's. / bashrc file

Echo "alias cls=clear" > > ~ / .bashrc 5. Given a file, such as / etc/inittab, determine whether there are blank lines in the file; if so, display the number of blank lines; otherwise, show that there are no blank lines. #! / bin/bash

FILE=/etc/inittab

If [!-e $FILE]; then

Echo "No $FILE."

Exit 8

Fi

If grep "^ $" $FILE & > / dev/null;then

Echo "Total blank lines: `grep" ^ $"$FILE | wc-l`." Else echo "No blank line." Fi 6. Given a user, determine whether the UID is the same as GID, and if so, show that the user is "good"; otherwise, the user is displayed as "bad" #! / bin/bash

USERNAME=user1

USERID= `id-u $USERNAME`

GROUPID= `id-g $USERNAME`

If [$USERID-eq $GROUPID]; then

Echo "good"

Else

Echo "bad"

Fi 7. Delete the blank character at the beginning of the line in the / etc/grub.conf file

Sed-r's @ ^ [[: spapce:]] + @ @ g' / etc/grub.conf

8. Replace the number 5 in the line "id:3:initdefault:" in the / etc/inittab file

Sed's @\ (id:\) [0-9]\ (: initdefault:\) @\ 15\ 2Secretg' / etc/inittab

9. Delete the blank lines in the / etc/inittab file

Sed'/ ^ $/ d' / etc/inittab

10. Delete the # sign and the white space character after the # sign in the / etc/inittab file. The order requires that the # sign must be followed by a white space character.

Sed-r's @ ^ # [[: space:]] + @ @ g' / etc/inittab

11. Take out the directory name of a file path echo "/ etc/rc.d/" | sed-r's @ ^ (/. * /) [^ /] + /? @\ 1Secretg'

12. Case application

Case $1 in

'start')

Echo "start server..."

'stop')

Echo "stop server..."

'restart')

Echo "restart server..."

'status')

Echo "running..."

*)

Echo "`basename $0` {start | stop | restart | status}"

Esac

On how to solve the liunx problem to share here, I hope that the above content can make you improve. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report