AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-36440

somethingSomething's questions

Martin Hope
somethingSomething
Asked: 2019-06-30 04:56:38 +0800 CST

Processos em uma sessão em um shell interativo versus em um script

  • 4

Se eu executar este comando em um script, ele não produzirá saída, exceto o cabeçalho do ps:

 # Taken from Advanced Bash Usage on youtube:

 echo "$(echo "$(echo "$(echo "$(ps wwf -s $$)")")")"

Esta é a saída:

$./testing.bash
  PID TTY      STAT   TIME COMMAND

mas aqui ele é executado em um terminal que produz a saída esperada :

$echo "$(echo "$(echo "$(echo "$(ps wwf -s $$)")")")"
  PID TTY      STAT   TIME COMMAND
18289 pts/4    Ss+    0:00 /bin/bash
17917 pts/4    S+     0:00  \_ /bin/bash
17918 pts/4    S+     0:00      \_ /bin/bash
17919 pts/4    S+     0:00          \_ /bin/bash
17920 pts/4    S+     0:00              \_ /bin/bash
17921 pts/4    R+     0:00                  \_ ps wwf -s 18289

PERGUNTA:

Você pode explicar a diferença e me mostrar a maneira correta de fazer isso?

Já tentei muitas coisas e pesquisei no google por 4 horas, se precisar posso listar o que tentei mas acho que não é relevante aqui.

$echo $SHELL
/bin/bash

e:

$head -1 testing.bash 
#!/bin/bash
bash shell-script
  • 1 respostas
  • 1175 Views
Martin Hope
somethingSomething
Asked: 2019-06-08 03:12:32 +0800 CST

Debian: Os seguintes pacotes foram mantidos... odbcinst AND odbcinst1debian2

  • 2

PROBLEMA:

Eu tive esses dois pacotes held back for weeks nowe não consigo me livrar deles,

The following packages have been kept back:
  odbcinst odbcinst1debian2

olhe aqui:

[10:53:34][kristjan] ~ ~↓↓$↓↓ sudo apt upgrade --with-new-pkgs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  odbcinst odbcinst1debian2
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
[10:53:44][kristjan] ~ ~↓↓$↓↓ sudo apt-get upgrade --with-new-pkgs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  odbcinst odbcinst1debian2
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
[10:53:53][kristjan] ~ ~↓↓$↓↓ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  odbcinst odbcinst1debian2
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
[10:55:08][kristjan] ~ ~↓↓$↓↓ sudo apt install odbcinst odbcinst1debian2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amarok-common amarok-utils apper apper-data avogadro-data cdparanoia cdrdao clamz debconf-kde-data debconf-kde-helper dvd+rw-tools espeak-ng-data festival festival-freebsoft-utils festlex-cmu festlex-poslex festvox-kallpc16k
  gnome-orca gnugo growisofs icoutils k3b-data kalzium-data kate-data kde-baseapps-data kde-runtime-data kdegames-card-data kdegames-mahjongg-data ktorrent-data ktouch-data kwrite libakonadiprotocolinternals1 libatk-adaptor
  libavogadro1 libdebconf-kde1 libdiscid0 libdmtx0a libdotconf0 libespeak-ng1 libestools2.4 libgadu3 libgpgme++2v5 libgpod-common libgpod4 libgpod4-nogtk libjs-mootools libkactivities6 libkcalcore4 libkcmutils4 libkcompactdisc4
  libkdeclarative5 libkdesu5 libkdnssd4 libkexiv2-11 libkexiv2-data libkidletime4 libkimap4 libkjsapi4 libkjsembed4 libkldap4 libkmime4 libkntlm4 libkonq5-templates libkpty4 libkresources4 libkrosscore4 libksane0 libkunitconversion4
  liblastfm1 liblimba0 libloudmouth1-0 libmariadbd18 libmeanwhile1 libmediastreamer-base3 libmusicbrainz5cc2v5 libmygpo-qt1 libntrack-qt4-1 libntrack0 libopenbabel4v5 libortp9 libotr5 libpcaudio0 libperl4-corelibs-perl libphonon4
  libpolkit-qt-1-1 libpoppler-qt4-4 libprison0 libqaccessibilityclient0 libqca2 libqca2-plugin-ossl libqca2-plugins libqimageblitz4 libqjson0 libqmobipocket1 libqrencode3 libqtassistantclient4 libqtscript4-core libqtscript4-gui
  libqtscript4-network libqtscript4-sql libqtscript4-uitools libqtscript4-xml libqtwebkit4 libsgutils2-2 libsolid4 libsonic0 libspeechd2 libtag-extras1 libthreadweaver4 ntrack-module-libnl-0 oxygen-icon-theme palapeli-data phonon
  phonon-backend-gstreamer phonon-backend-gstreamer-common polkit-kde-1 python-attr python-avogadro python-click python-colorama python-constantly python-incremental python-openssl python-pam python-pyasn1-modules python-qt4
  python-qt4-sql python-serial python-service-identity python-sip python-twisted-bin python-twisted-core python-zope.interface python3-brlapi python3-louis python3-pyatspi python3-speechd qhull-bin qtdeclarative4-kqtquickcharts-1
  sound-icons sound-theme-freedesktop speech-dispatcher speech-dispatcher-audio-plugins speech-dispatcher-espeak-ng speech-dispatcher-festival vcdimager xbrlapi
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  amarok dolphin4 jovie juk k3b k3b-i18n kaccessible kajongg kalzium katepart kcachegrind kchmviewer kde-baseapps kde-baseapps-bin kde-config-cddb kde-full kde-games-core-declarative kde-plasma-desktop kde-runtime kde-standard
  kdeaccessibility kdeadmin kdeedu kdegames kdegraphics kdegraphics-mobipocket kdelibs-bin kdelibs5-plugins kdemultimedia kdenetwork kdepasswd kdepimlibs-kio-plugins kdesdk kdesdk-kio-plugins kdesdk-misc kdesudo kdeutils kdewebdev
  kdoctools kfilereplace kfind kget kgoldrunner kgpg kigo kimagemapeditor kio-audiocd kio-mtp klinkstatus kmag kmousetool kmouth kmtrace kolf kommander konq-plugins konqueror konqueror-nsplugins konquest kopete kpart-webkit kpartloader
  kppp kremotecontrol kreversi ksaneplugin kscd ksirk ksnakeduel kspaceduel ksudoku ktorrent ktouch kubrick kuiviewer kuser libakonadi-contact4 libakonadi-kde4 libakonadi-kmime4 libiodbc2 libk3b6 libk3b6-extracodecs libkabc4
  libkatepartinterfaces4 libkcddb4 libkde3support4 libkdegames6abi1 libkdegamesprivate1abi1 libkdewebkit5 libkemoticons4 libkfile4 libkhtml5 libkio5 libkmediaplayer4 libknewstuff2-4 libknewstuff3-4 libknotifyconfig4 libkonq-common
  libkonq5abi1 libkonqsidebarplugin4a libkopete4 libkparts4 libkpimidentities4 libkpimtextedit4 libkpimutils4 libkprintutils4 libkrossui4 libktexteditor4 libktorrent-l10n libktorrent5 libkxmlrpcclient4 libmailtransport4 libnepomuk4
  libnepomukquery4a libnepomukutils4 libokularcore7 libplasma3 libreoffice-kde libsoprano4 libsyndication4 lskat okular palapeli plasma-scriptengine-javascript python-kde4 soprano-daemon svgpart sweeper task-kde-desktop
The following packages will be upgraded:
  odbcinst odbcinst1debian2
2 upgraded, 0 newly installed, 129 to remove and 0 not upgraded.
Need to get 147 kB of archives.
After this operation, 231 MB disk space will be freed.
Do you want to continue? [Y/n]n

O QUE JÁ TENTEI:

De acordo com um artigo em debian-administration.org ,

If the dependencies have changed on one of the packages you have installed so that a new package must be installed to perform the upgrade then that will be listed as "kept-back".

Solução cautelosa 1:

De acordo com a resposta de Pablo , você pode executar sudo apt-get --with-new-pkgs upgradee instalará os pacotes mantidos.

Isso tem a vantagem de não marcar os pacotes retidos como "instalados manualmente", o que poderia forçar mais intervenção do usuário no futuro (veja comentários).

Se a solução de Pablo funcionar para você, por favor, dê um upvote nela. Se não, por favor comente o que deu errado.

Solução cautelosa 2:

A solução cautelosa é executar sudo apt-get install <list of packages kept back>. Na maioria dos casos, isso dará aos pacotes retidos o que eles precisam para atualizar com sucesso.

Solução agressiva:

Uma solução mais agressiva é executar o sudo apt-get dist-upgrade, que forçará a instalação dessas novas dependências.

Mas dist-upgradepode ser bastante perigoso. Ao contrário do upgrade , ele pode remover pacotes para resolver situações de dependência complexas. Ao contrário de você, o APT nem sempre é inteligente o suficiente para saber se essas adições e remoções podem causar estragos.

Portanto, se você se encontrar em um lugar onde a "solução cautelosa" não funciona, dist-upgradepode funcionar ... mas provavelmente é melhor aprender um pouco mais sobre o APT e resolver os problemas de dependência "manualmente" instalando e removendo pacotes caso a caso.

Pense nisso como consertar um carro... se você tiver tempo e for habilidoso com uma chave inglesa, você terá um pouco de paz de espírito lendo e fazendo o reparo você mesmo. Se você estiver com sorte, pode deixar seu carro com sua prima dist-upgradee esperar que ela saiba das coisas dela.

E EU TAMBÉM TENTEI:

[11:06:55][kristjan] ~ ~↓↓$↓↓ sudo aptitude safe-upgrade
Resolving dependencies...                
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

PERGUNTA:

Como resolver isso e se livrar desse aviso irritante?

apt policy odbcinst odbcinst1debian2mostra

odbcinst:
  Installed: 2.3.4-1
  Candidate: 2.3.7
  Version table:
     2.3.7 500
        500 https://packages.microsoft.com/debian/9/prod stretch/main amd64 Packages
 *** 2.3.4-1 500
        500 http://deb.debian.org/debian stable/main amd64 Packages
        100 /var/lib/dpkg/status
odbcinst1debian2:
  Installed: 2.3.4-1
  Candidate: 2.3.7
  Version table:
     2.3.7 500
        500 https://packages.microsoft.com/debian/9/prod stretch/main amd64 Packages
 *** 2.3.4-1 500
        500 http://deb.debian.org/debian stable/main amd64 Packages
        100 /var/lib/dpkg/status
debian apt
  • 1 respostas
  • 2094 Views
Martin Hope
somethingSomething
Asked: 2019-06-06 09:13:00 +0800 CST

Como listar todos os pacotes instalados com a extensão .rpm. Fedora, Centos, Red Hat

  • 1

Como obtenho uma lista de todos os pacotes instalados com a .rpmextensão?

Estou testando isso em um Fedora 28.

fedora package-management
  • 2 respostas
  • 525 Views
Martin Hope
somethingSomething
Asked: 2019-05-09 03:07:43 +0800 CST

Como corrigir ".service: Iniciar solicitação repetida muito rapidamente." no serviço personalizado?

  • 8

Estou aprendendo a criar serviços com systemd. Eu recebo este erro:

.service: Start request repeated too quickly.

Não consigo mais iniciar o serviço; estava funcionando ontem. O que estou fazendo errado?

(root@Kundrum)-(11:03:19)-(~)
$nano /lib/systemd/system/swatchWATCH.service
 1 [Unit]
 2 Description=Monitor Logfiles and send Mail reports
 3 After=syslog.target network.target
 4
 5 [Service]
 6 Type=simple
 7 ExecStart=/usr/bin/swatch --config-file=/home/kristjan/.swatchrc --input-record-separator="\n \n " --tail-file=/var/log/snort/alert --daemon
 8 Restart=on-failure
 9 StartLimitInterval=3
10 StartLimitBurst=100
11
12 [Install]
13 WantedBy=multi-user.target

StartLimitIntervale StartLimitBursteu adicionei depois de tentar corrigi-lo.

Meu sistema é Debian 9.8 Esticar todas as atualizações.

debian systemd
  • 3 respostas
  • 27645 Views
Martin Hope
somethingSomething
Asked: 2019-04-20 02:31:32 +0800 CST

o apt está sempre bloqueado em outras tarefas quando quero atualizar meu sistema

  • 3

Muitas vezes quando quero updateum dos meus sistemas, aptfica "bloqueado" por outros processos. Pode acontecer mais de uma vez no mesmo dia. Tenho que rodar esse comando e killo processo top para aptvoltar, mas não deveria ter esse problema, nunca tive antes.

Quando eu apt updaterecebo isso:

root ~ # apt update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

Meu sistema é o Debian stretch 9.8, e instalo todas as atualizações. Eu uso o KDE Plasma Desktop.

root ~ # ps aux | grep apt
_apt     25783  9.0  0.1  64300 24956 ?        S    10:12   0:59 /usr/lib/apt/methods/http
_apt     25784  8.9  0.1  64300 25032 ?        S    10:12   0:59 /usr/lib/apt/methods/http
_apt     25785  8.9  0.2 206296 35636 ?        S    10:12   0:59 /usr/lib/apt/methods/https
_apt     25786  9.0  0.2 206300 35532 ?        S    10:12   0:59 /usr/lib/apt/methods/https
_apt     25787  9.0  0.1  64300 25012 ?        S    10:12   0:59 /usr/lib/apt/methods/http
_apt     25788  8.9  0.1  64300 25008 ?        S    10:12   0:58 /usr/lib/apt/methods/http
_apt     25789  9.1  0.1  64300 25192 ?        S    10:12   0:59 /usr/lib/apt/methods/http
_apt     25790  9.1  0.1  64300 24984 ?        S    10:12   0:59 /usr/lib/apt/methods/http
_apt     25817  4.8  0.1  56876 21644 ?        S    10:14   0:28 /usr/lib/apt/methods/gpgv
_apt     25818  4.8  0.2 206296 35568 ?        S    10:14   0:28 /usr/lib/apt/methods/https
_apt     25820  4.7  0.2 206304 35636 ?        S    10:14   0:27 /usr/lib/apt/methods/https
_apt     26426  0.0  0.1  56876 19752 ?        S    10:22   0:00 /usr/lib/apt/methods/gpgv
_apt     26427  0.0  0.0   4276  1656 ?        S    10:22   0:00 /bin/sh /usr/bin/apt-key --quiet --readonly verify --status-fd 3 /tmp/apt.sig.LTumm1 /tmp/apt.data.hNgDBV
_apt     26511  104  0.0  38092  8508 ?        R    10:23   0:03 apt-config shell GPGV Apt::Key::gpgvcommand
root     26513  0.0  0.0  12788  1000 pts/1    S+   10:23   0:00 grep apt

PERGUNTA:

Eu não entendo o que isso significa o que está fazendo apt e como corrigi-lo?

EDITAR:

pstree -a

root ~ # apt list packagekit
Listing... Done
packagekit/stable,stable,now 1.1.5-2+deb9u1 amd64 [installed,automatic]

root ~ # apt list aptdaemon
Listing... Done
debian apt
  • 2 respostas
  • 3227 Views
Martin Hope
somethingSomething
Asked: 2019-04-20 02:25:31 +0800 CST

Faça com que o logwatch envie relatórios apenas uma vez por semana

  • 3

Gostaria de diminuir o ruído dos logwatchrelatórios enviados ao meu e-mail em três sistemas.

É possível configurar o logwatch para enviar apenas alguns dias da semana ou uma vez por semana?

Dados mais relevantes:

logwatch8-é-muito-ruidoso-como-posso-controlar-o-nível de ruído no SERVERFAULT

/usr/share/logwatch/default.conf/logwatch.conf:

########################################################
# This was written and is maintained by:
#    Kirk Bauer <[email protected]>
#
# Please send all comments, suggestions, bug reports,
#    etc, to [email protected].
#
########################################################

# NOTE:
#   All these options are the defaults if you run logwatch with no
#   command-line arguments.  You can override all of these on the
#   command-line.

# You can put comments anywhere you want to.  They are effective for the
# rest of the line.

# this is in the format of <name> = <value>.  Whitespace at the beginning
# and end of the lines is removed.  Whitespace before and after the = sign
# is removed.  Everything is case *insensitive*.

# Yes = True  = On  = 1
# No  = False = Off = 0

# Default Log Directory
# All log-files are assumed to be given relative to this directory.
LogDir = /var/log

# You can override the default temp directory (/tmp) here
TmpDir = /var/cache/logwatch

#Output/Format Options
#By default Logwatch will print to stdout in text with no encoding.
#To make email Default set Output = mail to save to file set Output = file
Output = stdout
#To make Html the default formatting Format = html
Format = text
#To make Base64 [aka uuencode] Encode = base64
Encode = none

# Default person to mail reports to.  Can be a local account or a
# complete email address.  Variable Output should be set to mail, or
# --output mail should be passed on command line to enable mail feature.
MailTo = root
# WHen using option --multiemail, it is possible to specify a different
# email recipient per host processed.  For example, to send the report
# for hostname host1 to [email protected], use:
#Mailto_host1 = [email protected]
# Multiple recipients can be specified by separating them with a space.

# Default person to mail reports from.  Can be a local account or a
# complete email address.
MailFrom = Logwatch

# if set, the results will be saved in <filename> instead of mailed
# or displayed. Be sure to set Output = file also.
#Filename = /tmp/logwatch

# Use archives?  If set to 'Yes', the archives of logfiles
# (i.e. /var/log/messages.1 or /var/log/messages.1.gz) will
# be searched in addition to the /var/log/messages file.
# This usually will not do much if your range is set to just
# 'Yesterday' or 'Today'... it is probably best used with Range = All
# By default this is now set to Yes. To turn off Archives uncomment this.
#Archives = No

# The default time range for the report...
# The current choices are All, Today, Yesterday
Range = Today

# The default detail level for the report.
# This can either be Low, Med, High or a number.
# Low = 0
# Med = 5
# High = 10
Detail = 10


# The 'Service' option expects either the name of a filter
# (in /usr/share/logwatch/scripts/services/*) or 'All'.
# The default service(s) to report on.  This should be left as All for
# most people.
Service = All
# You can also disable certain services (when specifying all)
Service = "-zz-network"     # Prevents execution of zz-network service, which
                            # prints useful network configuration info.
Service = "-zz-sys"         # Prevents execution of zz-sys service, which
                            # prints useful system configuration info.
Service = "-eximstats"      # Prevents execution of eximstats service, which
                            # is a wrapper for the eximstats program.
# If you only cared about FTP messages, you could use these 2 lines
# instead of the above:
#Service = ftpd-messages   # Processes ftpd messages in /var/log/messages
#Service = ftpd-xferlog    # Processes ftpd messages in /var/log/xferlog
# Maybe you only wanted reports on PAM messages, then you would use:
#Service = pam_pwdb        # PAM_pwdb messages - usually quite a bit
#Service = pam             # General PAM messages... usually not many

# You can also choose to use the 'LogFile' option.  This will cause
# logwatch to only analyze that one logfile.. for example:
#LogFile = messages
# will process /var/log/messages.  This will run all the filters that
# process that logfile.  This option is probably not too useful to
# most people.  Setting 'Service' to 'All' above analyzes all LogFiles
# anyways...

#
# By default we assume that all Unix systems have sendmail or a sendmail-like MTA.
# The mailer code prints a header with To: From: and Subject:.
# At this point you can change the mailer to anything that can handle this output
# stream.
# TODO test variables in the mailer string to see if the To/From/Subject can be set
# From here with out breaking anything. This would allow mail/mailx/nail etc..... -mgt
mailer = "/usr/sbin/sendmail -t"

#
# With this option set to a comma separted list of hostnames, only log entries
# for these particular hosts will be processed.  This can allow a log host to
# process only its own logs, or Logwatch can be run once per a set of hosts
# included in the logfiles.
# Example: HostLimit = hosta,hostb,myhost
#
# The default is to report on all log entries, regardless of its source host.
# Note that some logfiles do not include host information and will not be
# influenced by this setting.
#
#HostLimit = myhost

# vi: shiftwidth=3 tabstop=3 et
linux logs
  • 2 respostas
  • 1548 Views
Martin Hope
somethingSomething
Asked: 2019-04-14 15:32:06 +0800 CST

Como fazer `trap` saber se o EXIT é após o término bem-sucedido do programa ou por causa de um erro prematuro ou algo assim

  • 5

PROBLEMA:

Eu tenho um programa shell que estou escrevendo, mas não consigo descobrir como ter certeza de que trapestá travando para limpeza no final ou por causa de um erro em algum comando, ele limpa de qualquer maneira.

Aqui está o código:

################################### Successful exit then this cleanup ###########################################################3

successfulExit()
{
    IFS=$IFS_OLD
    cd "$HOME" || { echo "cd $HOME failed"; exit 155; }
    rm -rf /tmp/svaka || { echo "Failed to remove the install directory!!!!!!!!"; exit 155; }
}
###############################################################################################################################33
####### Catch the program on successful exit and cleanup
trap successfulExit EXIT

PERGUNTA:

Como posso fazer trapapenas trap EXITno final do programa?

Aqui está o roteiro completo:

debianConfigAwsome.5.3.sh

shell-script exit-status
  • 1 respostas
  • 858 Views
Martin Hope
somethingSomething
Asked: 2019-04-12 01:44:32 +0800 CST

Quando um comando "cd" pode falhar em um script de shell e o que posso fazer para remediar isso?

  • 1

Eu tenho um script de shell que não foi concluído na semana passada; foi um cdcomando " " com falha e sai se falhar.

O script é um bashscript shell para configurar novas instalações Debian. Aqui está o script completo: debianConfigAswome.sh . O script é executado como root para ter acesso total ao sistema de arquivos.

Você pode listar todos os motivos pelos quais um script não seria capaz de executar um cdcomando com êxito e o que fazer para evitar o erro?

shell-script command
  • 1 respostas
  • 4671 Views
Martin Hope
somethingSomething
Asked: 2019-04-09 13:36:09 +0800 CST

apt update tem dois arquivos de índice com falha e não consigo encontrar nada na web sobre o que fazer

  • 2

Estou atualizando um dos meus sistemas e recebo um erro que não sei como corrigir ou qual é o problema.

Aqui está o erro:

E: Failed to fetch http://the.earth.li/debian/dists/stretch-updates/main/binary-i386/Packages  404  Not Found [IP: 46.43.34.31 80]
E: Failed to fetch http://the.earth.li/debian/dists/stretch/main/binary-i386/Packages  404  Not Found [IP: 46.43.34.31 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

root /home/kristjan # apt update                                                                                                                                                                                                    
Hit:1 http://ftp.debian.org/debian stretch-backports InRelease
Hit:2 http://security.debian.org/debian-security stretch/updates InRelease                                                                                                                                                     
Hit:3 http://download.virtualbox.org/virtualbox/debian stretch InRelease                       
Hit:4 https://download.mono-project.com/repo/debian stable-stretch InRelease                          
Hit:5 http://www.deb-multimedia.org stretch InRelease                                                 
Hit:6 http://repo.steampowered.com/steam precise InRelease                                            
Hit:7 https://deb.torproject.org/torproject.org stretch InRelease
Ign:8 http://the.earth.li/debian stretch InRelease 
Get:9 http://the.earth.li/debian stretch-updates InRelease [91.0 kB]
Get:10 http://the.earth.li/debian stretch Release [118 kB]    
Get:11 http://the.earth.li/debian stretch-updates/main Sources.diff/Index [8,608 B]
Get:12 http://the.earth.li/debian stretch-updates/main i386 Packages.diff/Index [8,608 B]
Get:12 http://the.earth.li/debian stretch-updates/main i386 Packages.diff/Index [8,608 B]
Ign:12 http://the.earth.li/debian stretch-updates/main i386 Packages.diff/Index
Get:15 http://the.earth.li/debian stretch Release.gpg [2,434 B]
Get:16 http://the.earth.li/debian stretch-updates/main Sources 2019-02-21-2009.35.pdiff [10.2 kB]
Get:17 http://the.earth.li/debian stretch-updates/main Sources 2019-03-27-2010.32.pdiff [471 B]
Get:18 http://the.earth.li/debian stretch-updates/main Sources 2019-03-30-2008.27.pdiff [726 B]
Get:19 http://the.earth.li/debian stretch-updates/main amd64 Packages 2019-02-21-2009.35.pdiff [4,149 B]
Get:20 http://the.earth.li/debian stretch-updates/main amd64 Packages 2019-03-27-2010.32.pdiff [531 B]
Get:21 http://the.earth.li/debian stretch-updates/main amd64 Packages 2019-03-30-2008.27.pdiff [1,599 B]
Get:22 http://the.earth.li/debian stretch-updates/main Translation-en 2019-02-21-2009.35.pdiff [5,483 B]
Get:18 http://the.earth.li/debian stretch-updates/main Sources 2019-03-30-2008.27.pdiff [726 B]
Get:22 http://the.earth.li/debian stretch-updates/main Translation-en 2019-02-21-2009.35.pdiff [5,483 B]
Get:21 http://the.earth.li/debian stretch-updates/main amd64 Packages 2019-03-30-2008.27.pdiff [1,599 B]
Ign:23 http://the.earth.li/debian stretch-updates/main i386 Packages                                     
Get:24 http://the.earth.li/debian stretch/non-free Sources [79.4 kB]
Get:25 http://the.earth.li/debian stretch/main Sources [6,746 kB]
Get:26 http://the.earth.li/debian stretch/main i386 Packages [7,064 kB]
Get:26 http://the.earth.li/debian stretch/main i386 Packages [7,064 kB]
Get:26 http://the.earth.li/debian stretch/main i386 Packages [7,064 kB]
Get:26 http://the.earth.li/debian stretch/main i386 Packages [7,064 kB]
Ign:26 http://the.earth.li/debian stretch/main i386 Packages
Ign:31 http://the.earth.li/debian stretch/non-free i386 Packages
Ign:23 http://the.earth.li/debian stretch-updates/main i386 Packages
Ign:26 http://the.earth.li/debian stretch/main i386 Packages
Ign:31 http://the.earth.li/debian stretch/non-free i386 Packages
Err:23 http://the.earth.li/debian stretch-updates/main i386 Packages
  404  Not Found [IP: 46.43.34.31 80]
Ign:26 http://the.earth.li/debian stretch/main i386 Packages
Ign:31 http://the.earth.li/debian stretch/non-free i386 Packages
Err:26 http://the.earth.li/debian stretch/main i386 Packages
  404  Not Found [IP: 46.43.34.31 80]
Ign:31 http://the.earth.li/debian stretch/non-free i386 Packages
Fetched 235 kB in 1s (125 kB/s)
Reading package lists... Done
E: Failed to fetch http://the.earth.li/debian/dists/stretch-updates/main/binary-i386/Packages  404  Not Found [IP: 46.43.34.31 80]
E: Failed to fetch http://the.earth.li/debian/dists/stretch/main/binary-i386/Packages  404  Not Found [IP: 46.43.34.31 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

Aqui está o sistema:

root /home/kristjan # cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Aqui está a lista de fontes:

root /home/kristjan # cat /etc/apt/sources.list
# 
#deb cdrom:[Debian GNU/Linux 9.4.0 _S
#deb cdrom:[Debian GNU/Linux 9.4.0 _S

deb http://www.deb-multimedia.org stretch main non-free

deb http://the.earth.li/debian/ stretch main non-free
deb-src http://the.earth.li/debian/ stretch main non-free

deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

# stretch-updates, previously known as 'volatile'
deb http://the.earth.li/debian/ stretch-updates main contrib non-free
deb-src http://the.earth.li/debian/ stretch-updates main contrib non-free

# Virtualbox Oracle
deb http://download.virtualbox.org/virtualbox/debian stretch contrib


#Tor###########################97
deb https://deb.torproject.org/torproject.org stretch main
deb-src https://deb.torproject.org/torproject.org stretch main
# For the stable version.
#deb tor://sdscoq7snqtznauu.onion/torproject.org stretch main


########################### Backports testingittt
#deb http://ftp.debian.org/debian stretch-backports main

Qual é o problema aqui e como posso corrigi-lo?

ATUALIZAR:

Eu tenho dois servidores ambos rodando o Debian Stretch 9.9 e com os mesmos servidores debian para pacotes e atualizações mas só consigo atualizar um deles , este me dá este erro:

~↓↓$↓↓ apt update
Hit:1 http://www.deb-multimedia.org stretch InRelease
Ign:2 http://the.earth.li/debian stretch InRelease                                                                                                        
Hit:3 http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic InRelease                                                                                 
Get:4 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]                                                                      
Hit:6 http://download.virtualbox.org/virtualbox/debian stretch InRelease                                                                                  
Hit:7 http://ftp.debian.org/debian stretch-backports InRelease                                                                                            
Get:5 http://the.earth.li/debian stretch-updates InRelease [91.0 kB]                                                                                      
Hit:9 http://repo.mysql.com/apt/debian stretch InRelease                                                                                    
Hit:10 https://packages.microsoft.com/debian/9/prod stretch InRelease                                      
Hit:11 https://packages.microsoft.com/repos/vscode stable InRelease                  
Get:8 http://the.earth.li/debian stretch Release [118 kB]                
Hit:12 https://deb.torproject.org/torproject.org stretch InRelease                                     
Get:13 http://security.debian.org/debian-security stretch/updates/main Sources [205 kB]                 
Get:14 http://the.earth.li/debian stretch Release.gpg [2,434 B]                                                       
Get:15 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [492 kB]                                       
Get:16 http://the.earth.li/debian stretch-updates/main Sources [13.1 kB]            
Get:17 http://the.earth.li/debian stretch-updates/main amd64 Packages [27.2 kB]                            
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [27.2 kB]                             
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [27.2 kB]                                               
Hit:21 http://repo.steampowered.com/steam precise InRelease                                                                             
Ign:18 http://the.earth.li/debian stretch-updates/main i386 Packages                                       
Ign:22 http://the.earth.li/debian stretch-updates/main i386 Contents (deb)          
Get:23 http://security.debian.org/debian-security stretch/updates/main i386 Packages [494 kB]
Ign:18 http://the.earth.li/debian stretch-updates/main i386 Packages                                         
Hit:24 https://download.mono-project.com/repo/debian stable-stretch InRelease                                
Ign:25 https://apt.jenslody.de/stable stretch InRelease                                                       
Err:22 http://the.earth.li/debian stretch-updates/main i386 Contents (deb)          
  404  Not Found [IP: 46.43.34.31 80]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]       
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]           
Hit:28 https://apt.jenslody.de/stable stretch Release                                    
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Get:18 http://the.earth.li/debian stretch-updates/main i386 Packages [169 kB]
Ign:18 http://the.earth.li/debian stretch-updates/main i386 Packages
Ign:36 http://the.earth.li/debian stretch/main i386 Packages
Get:37 http://the.earth.li/debian stretch/main i386 Contents (deb) [31.3 MB]
Get:38 http://the.earth.li/debian stretch/main amd64 Contents (deb) [31.4 MB]                                                                             
Get:39 http://the.earth.li/debian stretch/non-free amd64 Packages [78.3 kB]                                                                               
Ign:40 http://the.earth.li/debian stretch/non-free i386 Packages                                                                                          
Get:41 http://the.earth.li/debian stretch/non-free Translation-en [80.3 kB]                                                                               
Get:42 http://the.earth.li/debian stretch/non-free amd64 DEP-11 Metadata [7,180 B]                                                                        
Get:43 http://the.earth.li/debian stretch/non-free DEP-11 64x64 Icons [30.0 kB]                                                                           
Get:44 http://the.earth.li/debian stretch/non-free DEP-11 128x128 Icons [85.2 kB]                                                                         
Get:45 http://the.earth.li/debian stretch/non-free amd64 Contents (deb) [809 kB]                                                                          
Get:46 http://the.earth.li/debian stretch/non-free i386 Contents (deb) [750 kB]                                                                           
Ign:36 http://the.earth.li/debian stretch/main i386 Packages                                                                                              
Ign:40 http://the.earth.li/debian stretch/non-free i386 Packages                                                                                          
Ign:36 http://the.earth.li/debian stretch/main i386 Packages                                                                                              
Ign:40 http://the.earth.li/debian stretch/non-free i386 Packages                                                                                          
Err:36 http://the.earth.li/debian stretch/main i386 Packages                                                                                              
  404  Not Found [IP: 46.43.34.31 80]
Ign:40 http://the.earth.li/debian stretch/non-free i386 Packages                                                                                          
Fetched 44.7 MB in 13s (3,223 kB/s)                                                                                                                       
Reading package lists... Done
E: Failed to fetch http://the.earth.li/debian/dists/stretch-updates/main/Contents-i386  404  Not Found [IP: 46.43.34.31 80]
E: Failed to fetch http://the.earth.li/debian/dists/stretch/main/binary-i386/Packages  404  Not Found [IP: 46.43.34.31 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

Aqui estão outros listarquivos apenas para detalhes:

~↓↓$↓↓ ls -asil /etc/apt/sources.list.d/
total 36
1175229 4 drwxr-xr-x 2 root root 4096 May 18 09:52 .
1175056 4 drwxr-xr-x 6 root root 4096 May 23 01:54 ..
1178126 4 -rw-r--r-- 1 root root   67 May  2 08:18 linuxuprising-java.list
1178021 4 -rw-r--r-- 1 root root   75 Jan 17  2018 microsoft-prod.list
1177218 4 -rw-r--r-- 1 root root   70 Jul 12  2018 mono-official-stable.list
1176353 4 -rw-r--r-- 1 root root  712 May 13 06:23 mysql.list
1178155 4 -rw-r--r-- 1 root root  148 Jul 24  2018 steam.list
1178030 4 -rw-r--r-- 1 root root   64 Jul 21  2018 stretch-backports.list
1176782 4 -rw-r--r-- 1 root root   73 May 18 09:42 vscode.list

Aqui está sources.listno outro servidor:

deb http://www.deb-multimedia.org stretch main non-free

deb http://the.earth.li/debian/ stretch main non-free
deb-src http://the.earth.li/debian/ stretch main non-free

deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

# stretch-updates, previously known as 'volatile'
deb http://the.earth.li/debian/ stretch-updates main contrib non-free
deb-src http://the.earth.li/debian/ stretch-updates main contrib non-free

# Virtualbox Oracle
deb http://download.virtualbox.org/virtualbox/debian stretch contrib
linux debian
  • 1 respostas
  • 1309 Views
Martin Hope
somethingSomething
Asked: 2018-11-20 22:54:06 +0800 CST

Por que não consigo encontrar nada sobre este comando na rede? `statftime`

  • -2

PROBLEMA:

Estou aprendendo bashcom livros (Linux Shell Scripting com Bash, Ken O. Burch) e este livro que estou seguindo agora está usando este comando:

/usr/bin/statftime

mas não consigo encontrar este comando para o meu Linux

Estou usando o trecho Debian 9.0

PERGUNTA:

Você pode me falar sobre este comando e se é possível instalá-lo no Debian e como instalá-lo no Debian?

EDITAR:

O livro é um dos melhores bash(Linux Shell Scripting with Bash, Ken O. Burch) que já li (@Gilles) então isso provavelmente não é um truque e vou postar o código abaixo:

Aqui está o código:

#!/bin/bash -x
#
# polling.sh: a daemon using polling to check for new files

shopt -s -o nounset

declare -rx SCRIPT=${0##*/}
declare -rx INCOMING_FTP_DIR="/home/ftp/ftp_incoming"
declare -rx PROCESSING_DIR="/home/ftp/processing"
declare -rx statftime="/usr/local/bin/statftime"
declare FILE=""
declare FILES=""
declare NEW_FILE=""

printf "$SCRIPT started at %s\n" "`date`"

# Sanity checks
if [[ ! -d /home/ftp/ftp_incoming ]] || [[ ! -d /home/ftp/processing ]]
then
    mkdir -p /home/ftp/ftp_incoming
    mkdir -p /home/ftp/processing
    if [ "$?" -ne 0 ]
    then
        echo "You are a idiot"
    else
        echo "You succeded!"
    fi
fi
if test ! -r "$INCOMING_FTP_DIR"
then
    printf "%s\n" "$SCRIPT:$LINENO: unable to read the incoming directory --aborted" >&1
    exit 1
fi
if test ! -r "$PROCESSING_DIR"
then
    printf "%s\n" "$SCRIPT:$LINENO: unable to read the incoming directory --aborted" >&1
    exit 1
fi
if test ! -r "$statftime"
then
    printf "%s\n" "$SCRIPT:$LINENO: unable to find or execute $statftime --aborted" >&1
    exit 1
fi

# Poll for new FTP files

cd $INCOMING_FTP_DIR
while true
do
    #check for new files more than 30 minutes unchanged
    FILES=`find . -type f -mmin +30 -print`

    # If new files exist, move them to the processing directory

    if [ ! -z "$FILES" ]
    then
        printf "$SCRIPT: new files have arrived at %s\n" "`date`"
        printf "%s\n" "$FILES" |
        {
            while read FILE
            do
                # Remove leading "./"
                FILE=${FILE##*/}
                # Rename the file with the current time
                NEW_FILE=`$statftime -f "%_L%_a_%T.dat" "$FILE"`
                if [ -z "$NEW_FILE" ]
                then
                    printf "%s\n" "$SCRIPT:$LINENO: statftime failed to create a new filename--skipping"
                else
                    # Move the file to the processing directory
                    printf "%s\n" "$SCRIPT: moved $FILE to $PROCESSING_DIR/$NEW_FILE"
                    mv "$FILE" "$PROCESSING_DIR/$NEW_FILE"
                fi
            done
        }
    fi
    sleep 30
done


printf "$SCRIPT finished unexpectedly at %s\n" "`date`"
exit 1

Aqui estão algumas informações sobre o comando:

procurar

local

bash shell-script
  • 1 respostas
  • 90 Views
Martin Hope
somethingSomething
Asked: 2018-10-19 05:19:24 +0800 CST

Como suprimir uma mensagem de um programa ao instalá-lo para usar em um programa bash? [duplicado]

  • 7
Essa pergunta já tem resposta aqui :
apt-get install sem prompt do debconf (1 resposta)
Fechado há 4 anos .

PROBLEMA:

Eu tenho um programa escrito em bash que faz muitas coisas como instalar um novo software no sistema.

Um dos programas que ele instala tem uma mensagem extravagante onde você obtém algumas informações sobre o uso e o arquivo de configuração e o que ele faz se você não editar o arquivo de configuração.

E, em seguida, aguarda a entrada do usuário.

Esta mensagem é um dialogtipo de mensagem em uma GUI:

insira a descrição da imagem aqui

O programa que exibe esta mensagem é portsentrye o sistema é o Debian Stretch.

PERGUNTA:

Como posso suprimir esta mensagem para que não haja comunicação entre meu programa e o usuário?

debian shell-script
  • 1 respostas
  • 390 Views
Martin Hope
somethingSomething
Asked: 2018-10-19 01:34:30 +0800 CST

Você pode explicar essas três coisas neste código bash para mim?

  • 10

Eu tenho um functionno meu .bashrcarquivo. Eu sei o que ele faz, aumenta X muitos diretórios comcd

Aqui está:

up()
{
    local d=""
    limit=$1
    for ((i=1 ; i <= limit ; i++))
      do
        d=$d/..
      done
    d=$(echo $d | sed 's/^\///')
    if [ -z "$d" ]; then
      d=..
    fi
    cd $d
}

Mas você pode explicar essas três coisas para mim?

  1. d=$d/..
  2. sed 's/^\///'
  3. d=..

Por que não fazer assim:

up()
{
    limit=$1

    for ((i=1 ; i <= limit ; i++))
    do
        cd ..
    done
}

Uso:

<<<>>>~$ up 3
<<<>>>/$
shell sed
  • 2 respostas
  • 2115 Views
Martin Hope
somethingSomething
Asked: 2018-10-18 22:06:33 +0800 CST

Existe algo semelhante ou como "passar" em python na programação bash/shell?

  • 1

Às vezes, preciso de um comando como passem Python em meus scripts bash.

Curti:

if grep something
then
    pass
else
    code
fi

Em Python você tem:

>>> for element in a:
...     if not element:
...         pass
...     print element

PERGUNTA:

Eu sempre uso continuemas dá um erro que só deve ser usado em um for, whileou untilloop.

O que você faria nesta circunstância?

linux bash
  • 2 respostas
  • 3466 Views
Martin Hope
somethingSomething
Asked: 2018-10-18 20:38:28 +0800 CST

A variável $@ não está funcionando em um loop for, tentando iterar em uma lista de usuários

  • 1

PROBLEMA:

Não consigo fazer com que a $@variável faça o que quero em um loop for, o loop envia apenas um nome para o arquivo durante o loop, ele deve percorrer todos os argumentos e gravá-los no arquivo USERS.txt, cada um em sua própria linha.

Aqui está o arquivo:

something78
something79
something7
dagny
oli
bjarni
toti
stefan_hlynur
jessie

Segue o código de teste:

#!/bin/bash

prepare_USERS()
{
    /usr/bin/awk -F: '$3 >= 1000 { print $1 }' /etc/passwd > USERS.txt
    /bin/chmod 777 USERS.txt
    echo "$@"
    for user in "$@"
    do
        echo $user
        echo "$user" >> USERS.txt || echo "writing to USERS.txt failed"; exit 127
    done
}

prepare_USERS "$@"

#for user in "$@"
#do
#    echo "$user" >> USERS.txt
#done

for user in USERS.txt
do
    printf "%s" $user
done

Aqui estão os argumentos que passo:

./somethingDELETEme.sh jessie henry allison jason

Saída CORRENTE:

$./somethingDELETEme.sh jessie henry allison jason
jessie henry allison jason
jessie

Saída ESPERADA:

O loop percorre todos os nomes da lista de argumentos e os grava no arquivo USERS.txt.

PERGUNTA:

Já usei essa variável ( $@) antes e nunca tive esse problema.

Por que o loop não está iterando por todos os nomes na lista de argumentos ( $@) e como é a maneira correta de codificar isso?

AQUI ESTÁ O CÓDIGO VERDADEIRO:

prepare_USERS()
{
    checkIfUser
    /usr/bin/awk -F: '$3 >= 1000 { print $1 }' /etc/passwd > "$CURRENTDIR"/USERS.txt

    /bin/chmod 777 "CURRENTDIR"/USERS.txt
    for user in "$@"
    do
        echo "$user" >> "CURRENTDIR"/USERS.txt || echo "writing to USERS.txt failed"; exit 127
    done
}
bash shell-script
  • 1 respostas
  • 366 Views
Martin Hope
somethingSomething
Asked: 2018-10-16 17:57:32 +0800 CST

verificando se o iptables está definido em um sistema no script [duplicado]

  • 1
Essa pergunta já tem resposta aqui :
Diferença entre '>' e '-gt' (1 resposta)
Fechado há 4 anos .

Estou escrevendo um script no bash e preciso verificar se o iptables está definido...

if [ `iptables-save | grep '^\-' | wc -l` > 0 ]
then
    echo "Iptables already set, skipping..........!"
else
    Here the iptables get set

Mas não está funcionando como esperado....

PROBLEMA:

Eu fiz iptables-savee ele criou isso:

$iptables-save
# Generated by iptables-save v1.6.0 on Tue Oct 16 02:48:41 2018
*filter
:INPUT ACCEPT [2:266]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2:116]
COMMIT
# Completed on Tue Oct 16 02:48:41 2018

Então, se eu executar o teste, ele descobre que eles já estão definidos .... como aqui:

(root@notemDEB78)-(03:12:20)-(/home/something78/Bash_Programming_2018)
$s.sh
Iptables already set....skipping!!!!!
(root@notemDEB78)-(03:12:25)-(/home/something78/Bash_Programming_2018)
$iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

(root@notemDEB78)-(03:16:41)-(/home/something78/Bash_Programming_2018)
$iptables-save | grep '^\-' | wc -l
0

PERGUNTA:

  • Por que sempre descobre que o iptables está definido quando o obviamente não está
  • Você tem uma maneira melhor/funcional de verificar se iptablesestá definido .... meu sistema éDebian 9

    bash -versão GNU bash, versão 4.4.12(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. Licença GPLv3+: GNU GPL versão 3 ou posterior http://gnu. org/licenses/gpl.html

QUANTO À POSSÍVEL DUPLICATA:

Esta pergunta também está perguntando se alguém tem uma maneira melhor de verificar se o iptables está definido para um script no bash ....

EDITAR:

Por set quero dizer que o iptables foi configurado assim:

if [[ `iptables-save | grep '^\-' | wc -l` > 0 ]]
    then
        echo "Iptables already set....skipping!!!!!"
    else
        if [ "$PORT" = "" ]
        then
            echo "Port not set for iptables exiting"
            echo -n "Setting port now, insert portnumber: "
            read port
            PORT=$port
        fi
        if [ ! -f /etc/iptables.test.rules ]
        then
            touch /etc/iptables.test.rules
        else
            cat /dev/null > /etc/iptables.test.rules
        fi

        cat << EOT >> /etc/iptables.test.rules
        *filter

        # Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
        -A INPUT -i lo -j ACCEPT
        -A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT

        # Accepts all established inOAUTH_TOKEN=d6637f7ccf109a0171a2f55d21b6ca43ff053616bound connections
        -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

        # Allows all outbound traffic
        # You could modify this to only allow certain traffic
        -A OUTPUT -j ACCEPT

        # Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
        -A INPUT -p tcp --dport 80 -j ACCEPT
        -A INPUT -p tcp --dport 443 -j ACCEPT

        # Allows SSH connections
        # The --dport number is the same as in /etc/ssh/sshd_config
        -A INPUT -p tcp -m state --state NEW --dport $PORT -j ACCEPT

        # Now you should read up on iptables rules and consider whether ssh access
        # for everyone is really desired. Most likely you will only allow access from certain IPs.

        # Allow ping
        #  note that blocking other types of icmp packets is considered a bad idea by some
        #  remove -m icmp --icmp-type 8 from this line to allow all kinds of icmp:
        #  https://security.stackexchange.com/questions/22711
        -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

        # log iptables denied calls (access via dmesg command)
        -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

        # Reject all other inbound - default deny unless explicitly allowed policy:
        -A INPUT -j REJECT
        -A FORWARD -j REJECT

        COMMIT
EOT
        sed "s/^[ \t]*//" -i /etc/iptables.test.rules ## remove tabs and spaces
        /sbin/iptables-restore < /etc/iptables.test.rules || echo "iptables-restore failed"; exit 127
        /sbin/iptables-save > /etc/iptables.up.rules || echo "iptables-save failed"; exit 127
        printf "#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules" > /etc/network/if-pre-up.d/iptables ## create a script to run iptables on startup
        chmod +x /etc/network/if-pre-up.d/iptables || echo "cmod +x failed"; exit 127
    fi
bash shell-script
  • 2 respostas
  • 2653 Views
Martin Hope
somethingSomething
Asked: 2018-10-12 20:14:11 +0800 CST

Usando expressão regular para rm e ls

  • 0

PERGUNTA:

O que está acontecendo aqui e como faço para corrigir isso?

PROBLEMA:

Quando eu faço:

$ls | grep -P "file[1-9]{3}.txt|file[1-9]{2}.txt"

Eu recebo:

file11.txt
file12.txt
file13.txt
file14.txt
file15.txt
file16.txt
file17.txt
file18.txt
file19.txt
file21.txt
file22.txt
file23.txt
file24.txt
file25.txt
file26.txt
file27.txt
file28.txt
file29.txt
etc.

Mas quando eu faço:

$ls | grep -P "file[1-9]{3}.txt|file[1-9]{2}.txt" | xargs -d"\n" rm

Eu recebo:

rm: cannot remove ''$'\033''[38;5;253mfile11.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile12.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile13.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile14.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile15.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile16.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile17.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile18.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile19.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile21.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile22.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile23.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile24.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile25.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile26.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile27.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile28.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile29.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile31.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile32.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile33.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile34.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile35.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile36.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile37.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile38.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile39.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile41.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile42.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile43.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile44.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile45.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile46.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile47.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile48.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile49.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile51.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile52.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile53.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile54.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile55.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile56.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile57.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile58.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile59.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile61.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile62.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile63.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile64.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile65.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile66.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile67.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile68.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile69.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile71.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile72.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile73.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile74.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile75.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile76.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile77.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile78.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile79.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile81.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile82.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile83.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile84.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile85.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile86.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile87.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile88.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile89.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile91.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile92.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile93.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile94.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile95.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile96.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile97.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile98.txt'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[38;5;253mfile99.txt'$'\033''[0m': No such file or directory
etc.

RESULTADO DESEJADO:

rm remove todos os arquivos que correspondem ao regex

grep regular-expression
  • 2 respostas
  • 10628 Views
Martin Hope
somethingSomething
Asked: 2018-09-18 10:59:42 +0800 CST

Não estou obtendo a saída que quero do sed ao editar sshd_config

  • 0

Estou escrevendo um programa para configurar novas Debianinstalações, mas não consigo sedfazer o que quero. Quero adicionar novos usuários sshd_configcomoallowed users

mas recebo isso: Este é o resultado que recebo agora:

  6
  7 AllowUsers user
  8 AllowUsers something78
  9 AllowUsers something7
 10 AllowUsers something78
 11 AllowUsers something79
 12 AllowUsers something78
 13 AllowUsers something7
 14 AllowUsers something78

onde deveria estar: O resultado esperado é este:

     AllowUsers user
     AllowUsers something7
     AllowUsers something78
     AllowUsers something79

Aqui está o código:

setUPsshd()
 4 {
 5     if grep "Port $PORT" /etc/ssh/sshd_config
 6     then
 7         echo "sshd already set, skipping!"
 8     else
 9         #/bin/cp -f "$CURRENTDIR"/sshd_config /etc/ssh/sshd_config
10         sed -i "s/Port 22/Port $PORT/" /etc/ssh/sshd_config
11         for user in `awk -F: '$3 > 1000 { print $1 }' /etc/passwd`
12         do
13             sed -i "/AllowUsers/a AllowUsers $user" /etc/ssh/sshd_config
14         done
15         USERNAME=`awk -F: '$3 == 1000 { print $1 }' /etc/passwd`
16         if ! grep "AllowUsers $USERNAME" /etc/ssh/sshd_config
17         then
18             sed -i "/AllowUsers/a AllowUsers $USERNAME" /etc/ssh/sshd_config
19         fi
20         echo "chmod 644 /etc/ssh/sshd_config"
21         echo "/etc/init.d/ssh restart"
22     fi
23 }

Aqui está a saída de depuração:

+ PORT=22301
+ setUPsshd
+ grep 'Port 22' /etc/ssh/sshd_config
+ /bin/cp -f /tmp/svaka/sshd_config /etc/ssh/sshd_config
+ sed -i 's/Port 22/Port 22301/' /etc/ssh/sshd_config
++ awk -F: '$3 > 1000 { print $1 }' /etc/passwd
+ for user in `awk -F: '$3 > 1000 { print $1 }' /etc/passwd`
+ sed -i '/AllowUsers/a AllowUsers something79' /etc/ssh/sshd_config
+ for user in `awk -F: '$3 > 1000 { print $1 }' /etc/passwd`
+ sed -i '/AllowUsers/a AllowUsers something7' /etc/ssh/sshd_config
++ awk -F: '$3 == 1000 { print $1 }' /etc/passwd
+ USERNAME=something78
+ grep 'AllowUsers something78' /etc/ssh/sshd_config
+ sed -i '/AllowUsers/a AllowUsers something78' /etc/ssh/sshd_config
+ echo 'chmod 644 /etc/ssh/sshd_config'
chmod 644 /etc/ssh/sshd_config
+ echo '/etc/init.d/ssh restart'
/etc/init.d/ssh restart

PERGUNTA:

Como adiciono os usuários AllowedUsersno sshd_configsem as duplicatas? também você sabe o que está acontecendo no meu código?

sshd sed
  • 2 respostas
  • 660 Views
Martin Hope
somethingSomething
Asked: 2018-09-07 10:19:46 +0800 CST

sed com vários comandos, posso usar o sinalizador w (write)?

  • 0

Aqui estou aprendendo sed, aqui está com vários comandos:

(user@host)-(18:27:39)-(~/Bash_Programming)
$sed '4 { s/fox/elephant/; s/dog/cat/ }' catAndDog.txt 
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown elephant jumps over the lazy cat
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog

Mas onde coloco o sinalizador de substituição w se estiver usando vários comandos e quiser que os resultados sejam gravados em um arquivo?

w file = write the result of the substitution to a file

EDITAR:

Eu quero gravar toda a saída no arquivo, uma cópia do original com as alterações feitas.

text-processing sed
  • 3 respostas
  • 1107 Views
Martin Hope
somethingSomething
Asked: 2018-09-05 11:47:35 +0800 CST

Essa saída de “who -a” é normal?

  • 2

Isso não me parece normal:

who -a
           system boot  2018-09-04 11:59
LOGIN      tty1         2018-09-04 11:59               685 id=tty1
           run-level 5  2018-09-04 11:59
user + pts/0        2018-09-04 20:39   .         19612 (192.168.1.173)
user + pts/1        2018-09-04 12:15 08:27        9252 (:0)
           pts/2        2018-09-04 13:02             12256 id=ts/2  term=0 exit=0
           pts/3        2018-09-04 13:02             12265 id=ts/3  term=0 exit=0
           pts/4        2018-09-04 13:02             12274 id=ts/4  term=0 exit=0
           pts/5        2018-09-04 13:02             12283 id=ts/5  term=0 exit=0
           pts/6        2018-09-04 13:02             12293 id=ts/6  term=0 exit=0
           pts/7        2018-09-04 13:02             12302 id=ts/7  term=0 exit=0
           pts/8        2018-09-04 13:02             12311 id=ts/8  term=0 exit=0
           pts/9        2018-09-04 13:02             12320 id=ts/9  term=0 exit=0
           pts/10       2018-09-04 13:02             12329 id=s/10  term=0 exit=0
           pts/11       2018-09-04 13:02             12338 id=s/11  term=0 exit=0
           pts/12       2018-09-04 13:02             12347 id=s/12  term=0 exit=0
           pts/14       2018-09-04 12:39             11677 id=s/14  term=0 exit=0
           pts/15       2018-09-04 12:39             11687 id=s/15  term=0 exit=0
           pts/18       2018-09-04 12:18             10435 id=s/18  term=0 exit=0
           pts/22       2018-09-04 12:03              5066 id=s/22  term=0 exit=0
           pts/23       2018-09-04 12:03              5075 id=s/23  term=0 exit=0
           pts/24       2018-09-04 12:03              5084 id=s/24  term=0 exit=0
           pts/25       2018-09-04 12:03              5093 id=s/25  term=0 exit=0
           pts/26       2018-09-04 12:03              5102 id=s/26  term=0 exit=0
           pts/27       2018-09-04 12:03              5112 id=s/27  term=0 exit=0
           pts/28       2018-09-04 12:03              5121 id=s/28  term=0 exit=0
           pts/29       2018-09-04 12:03              5130 id=s/29  term=0 exit=0
           pts/30       2018-09-04 12:03              5139 id=s/30  term=0 exit=0
           pts/31       2018-09-04 12:03              5148 id=s/31  term=0 exit=0
           pts/32       2018-09-04 12:03              5157 id=s/32  term=0 exit=0
           pts/33       2018-09-04 12:03              5166 id=s/33  term=0 exit=0
           pts/34       2018-09-04 12:03              5175 id=s/34  term=0 exit=0
           pts/35       2018-09-04 12:03              5184 id=s/35  term=0 exit=0
           pts/36       2018-09-04 12:03              5193 id=s/36  term=0 exit=0
           pts/46       2018-09-04 12:00              2093 id=s/46  term=0 exit=0
           pts/47       2018-09-04 12:00              2102 id=s/47  term=0 exit=0
           pts/48       2018-09-04 12:00              2111 id=s/48  term=0 exit=0
           pts/49       2018-09-04 12:00              2120 id=s/49  term=0 exit=0
           pts/50       2018-09-04 12:00              2129 id=s/50  term=0 exit=0
           pts/51       2018-09-04 12:00              2138 id=s/51  term=0 exit=0
           pts/52       2018-09-04 12:00              2147 id=s/52  term=0 exit=0
           pts/53       2018-09-04 12:00              2156 id=s/53  term=0 exit=0
           pts/54       2018-09-04 12:00              2165 id=s/54  term=0 exit=0
           pts/55       2018-09-04 12:00              2174 id=s/55  term=0 exit=0
           pts/56       2018-09-04 12:00              2183 id=s/56  term=0 exit=0
           pts/57       2018-09-04 12:00              2192 id=s/57  term=0 exit=0
           pts/58       2018-09-04 12:00              2201 id=s/58  term=0 exit=0
           pts/59       2018-09-04 12:00              2210 id=s/59  term=0 exit=0
           pts/60       2018-09-04 12:00              2219 id=s/60  term=0 exit=0
           pts/61       2018-09-04 12:00              2228 id=s/61  term=0 exit=0
           pts/62       2018-09-04 12:00              2238 id=s/62  term=0 exit=0
           pts/63       2018-09-04 12:00              2247 id=s/63  term=0 exit=0
           pts/64       2018-09-04 12:00              2256 id=s/64  term=0 exit=0
           pts/65       2018-09-04 12:00              2265 id=s/65  term=0 exit=0
           pts/66       2018-09-04 12:00              2274 id=s/66  term=0 exit=0
           pts/67       2018-09-04 12:00              2283 id=s/67  term=0 exit=0
           pts/68       2018-09-04 12:00              2292 id=s/68  term=0 exit=0
           pts/69       2018-09-04 12:00              2301 id=s/69  term=0 exit=0
           pts/70       2018-09-04 12:00              2310 id=s/70  term=0 exit=0
           pts/71       2018-09-04 12:00              2319 id=s/71  term=0 exit=0
           pts/72       2018-09-04 12:00              2328 id=s/72  term=0 exit=0
           pts/73       2018-09-04 12:00              2337 id=s/73  term=0 exit=0
           pts/74       2018-09-04 12:00              2346 id=s/74  term=0 exit=0
           pts/75       2018-09-04 12:00              2355 id=s/75  term=0 exit=0
           pts/76       2018-09-04 12:00              2364 id=s/76  term=0 exit=0
           pts/77       2018-09-04 12:00              2373 id=s/77  term=0 exit=0
           pts/78       2018-09-04 12:00              2403 id=s/78  term=0 exit=0
           pts/79       2018-09-04 12:00              2412 id=s/79  term=0 exit=0
           pts/80       2018-09-04 12:00              2421 id=s/80  term=0 exit=0
           pts/81       2018-09-04 12:00              2431 id=s/81  term=0 exit=0
           pts/82       2018-09-04 12:00              2440 id=s/82  term=0 exit=0
           pts/83       2018-09-04 12:00              2449 id=s/83  term=0 exit=0
           pts/84       2018-09-04 12:00              2458 id=s/84  term=0 exit=0
           pts/85       2018-09-04 12:00              2467 id=s/85  term=0 exit=0
           pts/86       2018-09-04 12:00              2476 id=s/86  term=0 exit=0
           pts/87       2018-09-04 12:00              2485 id=s/87  term=0 exit=0
           pts/88       2018-09-04 12:00              2494 id=s/88  term=0 exit=0
           pts/89       2018-09-04 12:00              2503 id=s/89  term=0 exit=0
           pts/90       2018-09-04 12:00              2512 id=s/90  term=0 exit=0
           pts/91       2018-09-04 12:00              2521 id=s/91  term=0 exit=0
           pts/92       2018-09-04 12:00              2530 id=s/92  term=0 exit=0
           pts/93       2018-09-04 12:00              2539 id=s/93  term=0 exit=0
           pts/94       2018-09-04 12:00              2548 id=s/94  term=0 exit=0
           pts/95       2018-09-04 12:00              2599 id=s/95  term=0 exit=0
           pts/96       2018-09-04 12:00              2657 id=s/96  term=0 exit=0
           pts/97       2018-09-04 12:00              2710 id=s/97  term=0 exit=0
           pts/98       2018-09-04 12:00              2755 id=s/98  term=0 exit=0
           pts/99       2018-09-04 12:00              2784 id=s/99  term=0 exit=0
           pts/100      2018-09-04 12:00              2809 id=/100  term=0 exit=0
           pts/101      2018-09-04 12:00              2818 id=/101  term=0 exit=0
           pts/102      2018-09-04 12:00              2827 id=/102  term=0 exit=0
           pts/103      2018-09-04 12:00              2836 id=/103  term=0 exit=0
           pts/104      2018-09-04 12:00              2845 id=/104  term=0 exit=0
           pts/105      2018-09-04 12:00              2854 id=/105  term=0 exit=0
           pts/106      2018-09-04 12:00              2863 id=/106  term=0 exit=0
           pts/107      2018-09-04 12:00              2872 id=/107  term=0 exit=0
           pts/108      2018-09-04 12:00              2881 id=/108  term=0 exit=0
           pts/109      2018-09-04 12:00              2890 id=/109  term=0 exit=0
           pts/110      2018-09-04 12:00              2899 id=/110  term=0 exit=0
           pts/111      2018-09-04 12:00              2908 id=/111  term=0 exit=0
           pts/112      2018-09-04 12:00              2917 id=/112  term=0 exit=0
           pts/113      2018-09-04 12:00              2926 id=/113  term=0 exit=0
           pts/114      2018-09-04 12:00              2935 id=/114  term=0 exit=0
           pts/115      2018-09-04 12:00              2944 id=/115  term=0 exit=0
           pts/116      2018-09-04 12:00              2953 id=/116  term=0 exit=0
           pts/117      2018-09-04 12:00              2962 id=/117  term=0 exit=0
           pts/118      2018-09-04 12:00              2971 id=/118  term=0 exit=0
           pts/119      2018-09-04 12:00              2981 id=/119  term=0 exit=0
           pts/120      2018-09-04 12:00              2990 id=/120  term=0 exit=0
           pts/121      2018-09-04 12:00              2999 id=/121  term=0 exit=0
           pts/122      2018-09-04 12:00              3008 id=/122  term=0 exit=0
           pts/123      2018-09-04 12:00              3017 id=/123  term=0 exit=0
           pts/124      2018-09-04 12:00              3026 id=/124  term=0 exit=0
           pts/125      2018-09-04 12:00              3035 id=/125  term=0 exit=0
           pts/126      2018-09-04 12:00              3044 id=/126  term=0 exit=0
           pts/127      2018-09-04 12:00              3053 id=/127  term=0 exit=0
           pts/128      2018-09-04 12:00              3062 id=/128  term=0 exit=0
           pts/129      2018-09-04 12:00              3071 id=/129  term=0 exit=0
           pts/130      2018-09-04 12:00              3080 id=/130  term=0 exit=0
           pts/131      2018-09-04 12:00              3089 id=/131  term=0 exit=0
           pts/132      2018-09-04 12:00              3098 id=/132  term=0 exit=0
           pts/133      2018-09-04 12:00              3107 id=/133  term=0 exit=0
           pts/134      2018-09-04 12:00              3116 id=/134  term=0 exit=0
           pts/135      2018-09-04 12:00              3125 id=/135  term=0 exit=0
           pts/136      2018-09-04 12:00              3134 id=/136  term=0 exit=0
           pts/137      2018-09-04 12:00              3145 id=/137  term=0 exit=0
           pts/138      2018-09-04 12:00              3154 id=/138  term=0 exit=0
           pts/139      2018-09-04 12:00              3163 id=/139  term=0 exit=0
           pts/140      2018-09-04 12:00              3172 id=/140  term=0 exit=0
           pts/141      2018-09-04 12:00              3181 id=/141  term=0 exit=0
           pts/142      2018-09-04 12:00              3190 id=/142  term=0 exit=0
           pts/143      2018-09-04 12:00              3199 id=/143  term=0 exit=0
           pts/144      2018-09-04 12:00              3208 id=/144  term=0 exit=0
           pts/145      2018-09-04 12:00              3217 id=/145  term=0 exit=0
           pts/146      2018-09-04 12:00              3226 id=/146  term=0 exit=0
           pts/147      2018-09-04 12:00              3235 id=/147  term=0 exit=0
           pts/148      2018-09-04 12:00              3244 id=/148  term=0 exit=0
           pts/149      2018-09-04 12:00              3253 id=/149  term=0 exit=0
           pts/150      2018-09-04 12:00              3262 id=/150  term=0 exit=0
           pts/151      2018-09-04 12:00              3271 id=/151  term=0 exit=0
           pts/152      2018-09-04 12:00              3280 id=/152  term=0 exit=0
           pts/153      2018-09-04 12:00              3289 id=/153  term=0 exit=0
           pts/154      2018-09-04 12:00              3299 id=/154  term=0 exit=0
           pts/155      2018-09-04 12:00              3308 id=/155  term=0 exit=0
           pts/156      2018-09-04 12:00              3317 id=/156  term=0 exit=0

PERGUNTA: O que isso significa?

Eu tenho outro problema louco neste sistema.

debian login
  • 1 respostas
  • 163 Views
Martin Hope
somethingSomething
Asked: 2018-09-05 04:46:57 +0800 CST

awk imprime de passwd mas apenas com userid > 1000

  • 0

Ok já fiz:

cat /etc/passwd | awk -F: '{ print $1 }'
  • -F ==> Especifique um separador de arquivo para delinear campos de dados em uma linha
  • $1 ==> Representa o primeiro campo na entrada

mas como imprimir apenas usuários com idover 1000?

awk scripting
  • 1 respostas
  • 1089 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve