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

What are the Linux utility commands

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about what the Linux utility commands are about. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Bc

This Linux command is used for mathematical operations with high precision. Such as: open square root and so on. Write a script using the bc command (filename: sqrt)

#! / bin/bash if [$then echo 'Usage: sqrt number' exit 1 else echo-e "sqrt ($1)\ nquit\ n" | bc-Q-I fi

Next, you can use this script to perform the square root operation:

[hchen@RHELSVR5] $. / sqrt 36 6 [hchen@RHELSVR5] $. / sqrt 2.0000 1.4142 [hchen@RHELSVR5] $. / sqrt 10.0000 3.1622

2. Split

If your file is large and you are ordered to split it into small files, this order will come in handy.

[hchen@RHELSVR5 applebak] # ls-l largefile.tar.gz-rw-r--r-- 1 hchen hchen 436774774 04-17 02:00 largefile.tar.gz [hchen@RHELSVR5 applebak] # split-b 50m largefile.tar.gz LF_ [hchen@RHELSVR5] # ls-l LF_*-rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_aa-rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ab-rw-r- -LF_ac-rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ac-rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ad-rw-r--r-- 1 hchen hchen 52428800 05-10 18:34 LF_ae-rw-r--r-- 1 hchen hchen 52428800 05-10 18:35 LF_af-rw-r--r-- 1 hchen hchen 52428800 05-10 18:35 LF_ag-rw-r--r-- 1 hchen hchen 52428800 05- 10 18:35 LF_ah-rw-r--r-- 1 hchen hchen 17344374 05-10 18:35 LF_ai

On the contrary, a merger only requires a simple merger, such as:

[hchen@RHELSVR5] # cat LF_* > largefile.tar.gz

3. Pgrep

There is a p before the name of pgrep, and it can be guessed that it may have something to do with grep, which is indeed a process-related grep command. However, this command is mainly used to enumerate the process ID. Such as:

$pgrep-u hchen 22441 22444

This command is equivalent to:

Ps-ef | egrep'^ hchen' | awk'{print $2}'

4. Nl

The nl command is similar to the cat command, except that it is marked with a line number. As follows:

[hchen@RHELSVR5 include] # nl stdio.h | head-n 10 1 / * Define ISO C stdio on top of C++ iostreams. 2 Copyright (C) 1991, 1994-2004, 2005, 2006 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 The GNU C Library is distributed in the hope that it will be useful

5. Ldd

This command is used for executable files that use dynamic link libraries. Such as:

[hchen@RHELSVR5 ~] # ldd / usr/bin/java linux-gate.so.1 = > (0x00cd9000) libgij.so.7rh = > / usr/lib/libgij.so.7rh (0x00ed3000) libgcj.so.7rh = > / usr/lib/libgcj.so.7rh (0x00ed6000) libpthread.so.0 = > / lib/i686/nosegneg/libpthread.so.0 (0x00110000) librt.so.1 = > / lib/i686/nosegneg/librt.so .1 (0x009c8000) libdl.so.2 = > / lib/libdl.so.2 (0x008b5000) libz.so.1 = > / usr/lib/libz.so.1 (0x00bee000) libgcc_s.so.1 = > / lib/libgcc_s.so.1 (0x00aa7000) libc.so.6 = > / lib/i686/nosegneg/libc.so.6 (0x0022f000) libm.so.6 = > / lib/i686/nosegneg/libm.so. 6 (0x00127000) / lib/ld-linux.so.2 (0x00214000)

6. Col

This command converts man files into plain text files. The following is an example:

# PAGER=cat # man less | col-b > less.txt Thank you for reading! This is the end of this article on "what are the practical commands for Linux?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Servers

Wechat

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

12
Report