Most voted "shell" questions
This is a program that takes, interprets and executes user commands, appearing on the screen as a command line, represented by a command interpreter, which waits on the screen for user commands. " Shell" is also used to describe applications, including software that is "built around" a specific component, such as browsers and email clients that are themselves "shells" for HTML rendering engines.
Learn more…208 questions
Sort by count of
-
2
votes1
answer175
views -
2
votes2
answers225
viewsShell_exec(): How to keep process active when restarting apache?
The processes run by php shell_exec() end up restarting apache. It is possible to keep processes active without interruptions when restarting apache? Below the code I’m using: $Command = "ksh -c '(…
-
2
votes1
answer1956
viewsHow to pass filename with accentuation and spaces as parameter for shell script file
I densenveloped a shell script that gets the location of a file and does several manipulations on it, e.g.: ./processes.sh path/file.txt However, when I send a file name as a parameter that contains…
-
2
votes1
answer161
viewsFramework (Java) for Opening remote sessions for executing Unix-based Server commands
I needed a framework to be able to open remote sessions on (Unix-based) servers and run commands remotely (if possible as root even). Does anyone know any mature who can serve this purpose? Main…
-
2
votes2
answers106
viewsswap commands in the shell
The command python foo.py When called on the terminal, it runs the uploaded python file. Imagine that I have a python file that always needs to be called as follows: xvfb-run python foo.py to work.…
-
2
votes2
answers315
viewsShell script with no return function
I have the following function: function ping { nome=$(dialog --title "inform o endereço que deseja PINGAR" --inputbox "IP ou URL - \ Lembrando que será disparado 10 pings para o endereço informado."…
-
2
votes2
answers81
viewsHow to delete the first line of a megaheavy SQL file?
I have a "mega heavy" SQL file that doesn’t open in the sublime, nor in the notepad nor in gedit. I just need to delete the first line Use nome_database; to be able to import via the mysql Workbench…
-
2
votes2
answers58
viewsError using alias and read in Shellscript
I’m trying to create a command on. Ubuntu bashrc, however I’m having a problem, I’m trying to create a folder with the variable typed when calling the alias, but it’s giving error. When I open the…
-
2
votes2
answers1017
viewssyntax error near Unexpected token `fi' Linux
I’ve been trying to make a code to automate the steamcmd but always gave me this mistake syntax error near Unexpected token `fi', someone could help me? Code:…
-
2
votes1
answer199
viewsWrong return of ping command
Taking into account that the ${parameters} is an array that can contain valid IP addresses or not, I wrote the following code: for ((i=0; i<$#; i++)); do eval "arg=\${$i}" ping ${parameters[i]}…
-
2
votes1
answer472
viewsHow to sort a column of a file without ordering the rows?
I have a file that has three columns, and several rows. The second column is composed of numerical values, and I want to reorganize it, in ascending order, but without affecting the previous column…
-
2
votes2
answers81
viewsHow to print Ipv6 Global using grep and awk?
It’s been a few days since I’ve been searching the Internet for such an answer, but I haven’t had one so far. I am trying to print Ipv6 Global from ifconfig to be used in MOTD on Ubuntu. With Ipv4…
-
2
votes2
answers1262
viewsHow to run mysql database using shell script if the base name has "-"
On the server there are some databases with the name modelo-submodelo (this is the name of the database, created with "-" same). When I execute a command like: mysqldump -h"$DBHOST" -u"$DBUSER"…
-
2
votes1
answer1801
viewsexecute shell file in Ubuntu by crontab
I’m trying to make a task schedule on linux to run a file sh, does not, however, implement the crontab, but execute when I do it in hand. I did a scheduling test to create a text file, it works, but…
-
2
votes1
answer252
viewsCreate an environment variable for users without access to bash (/sbin/nologin)?
I am trying to create an environment variable that will be accessed by a php script by the user that runs httpd (user: apache). It is set to /sbin/nologin and therefore does not access .profile,…
-
2
votes3
answers861
viewsHow to recursively rename numbered files by naming other files
What I am currently looking to do is rename all files in a folder, where there are also other files of different format. See Example: FOLDER - BEFORE 1.txt 2.txt 3.txt Daniela.jpg Amanda.jpg…
-
2
votes4
answers117
viewsCopy one line at a time from the source file to the target files
A new need arose accompanied by a good and new question that until then did not find anything similar on the internet - Copy a single line at a time to a different single file. Example for each new…
-
2
votes3
answers3476
viewsGrep with multiple parameters
I need to select the lines of a file that contains the characters | or \ diff -y ontem.csv hoje.csv | grep -e "|" -e "\" How to tell pro grep to return the lines it contains or a pipe | or a bar \…
-
2
votes2
answers151
viewsDoubt about shell script
I’m studying linux, and it’s my first contact with the shell script, the documentation I wanted to do is the following: #!/bin/bash if [ uname - m = "x86_64" ]; then echo "sua versão é de 64bits"…
-
2
votes1
answer1166
viewsWhich Way to Recursively Remove Accented Characters from File Names
I tried other scripts I found online (*os I found), but to no avail. So I want to know some of you(s) how to do this automated/recursive task. Shell Script Taken from: https://tsgii.blogspot.com/…
-
2
votes2
answers740
viewsShell Script - insert variable in a command
Hello, first I want to say that I am beginner in shell script. My doubt is: I have a script that will execute a series of commands, one of these commands is an "input" in which asks me to type a…
-
2
votes1
answer167
viewsshell_exec php with accent
I need to rotate a command via shell which can have accent (involves filename) by PHP. Printing the command and rotating it in the hand it runs with the accent, but with the shell_exec it does not…
-
2
votes1
answer15108
viewsHow to declare a variable in . BAT ("shell")?
I’m starting to mess with file. BAT, and I created a command line. Example: ping <nome do computador> Below it would show me if it is online, would look like this: ping computador_1 But I…
-
2
votes1
answer142
viewsRegular Expression is correct but does not enter if
I wonder why my code isn’t getting into this if more internal. I tested regex for some websites and it’s working. I tested with this value: nucepe-2018-pc-pi-perito-criminal-informatica-prova.pdf.…
-
2
votes3
answers3774
viewsWrite text to Shell Script
I am making a Shell Script, and I have to record a lot of lines in a single file, how can I do this more automatically? 'Cause I started doing it in a very manual way: echo "primeira linha do…
-
2
votes1
answer79
viewsHow do I pass an array as an argument in PHP and receive all the data in the shell?
Example: <?php $param=array(valor, valor2, valor3); $return = shell_exec("sh teste.sh $param"); echo "<pre>$return</pre>"; ?> Shell script: #!/bin/bash param=$1 echo $param That…
-
2
votes1
answer91
viewsWhat’s the difference between SEQ and FOR I IN in shell script
I started studying shell script recently and gave me 2 examples, and I would like to know the difference of the commands, when it is better to use one or the other. The example was seq 1 5| and the…
-
2
votes1
answer187
viewsHow to print vector formatted in Shell?
I’m trying to get a string and change only one of its values, and that’s easy using vectors. However, when printing the string, the vector leaves without formatting, I have tried to print it with…
-
2
votes2
answers50
viewsReturn filtered values in Shell Bash for insertion in BD
I’m writing a script on python who captures the TOP 5 ram and CPU memory consumption processes of the machine, so far the script is functional only for LINUX, goes below: Script: #!/usr/bin/env…
-
2
votes1
answer167
viewsHow to calculate the distance of devices over WI-FI using force and signal frequency?
How can I calculate the distance of a device by wifi, using the strength of the signal of the same? I’m using tshark (wireshark) to perform this 802.11 scan, capturing only Prob requests (the moment…
-
2
votes1
answer373
viewsConnect to a host via SSH and go to another with ssh - Python tunnel
The code below (main.py) provides access to a host through SSH and creates a tunnel for the IP to be accessed by 127.0.0.1: import paramiko from sshtunnel import SSHTunnelForwarder from paramiko…
-
2
votes1
answer167
viewsShell Script to calculate average runtime
I need to perform the same command 10 times and view the average run time. I did the script below, but it always returns the same output, zero, see print below. Could you help me find the error?…
-
1
votes1
answer298
viewsShellscript command cd
Which command do I use to go straight to folder login without having to put my name example cd home/leonardovillela.?
-
1
votes2
answers69
viewsScript does not show the entire path
Code: for i in `find $1 -name $4 -type f` ; do path=`readlink -f $4` words=`cat "$i" | wc -w` echo "$path: $words palavras" done Prints: /home/miglui/Desktop/SO/teste.txt: 14 palavras…
-
1
votes2
answers73
viewsIgnore n no with bash >>
Hello I have a PHP script that I run on a server, I put it in a cron. For security and maintenance reasons I write all the return of STDERR in a file, but even if the file does not return me…
-
1
votes1
answer45
viewsError: Shell class Syncaccesstokenshell could not be found
My app is cake 2.4.4, is hosted on Amazon. Before the server was apache, but now we migrate to Nginx for better performance. As it was to be expected several problems occurred (normal), one more of…
-
1
votes1
answer118
viewsWhy can’t I run the file located in the bin?
I need to use the file flare and flasm, which chown and permission are correct. Why can I execute only one and not the other? -rwxr-xr-x 1 daniela.morais sudo 64808 Mar 19 13:54 flare* -rwxr-xr-x 1…
-
1
votes1
answer120
views[PHP Apache Shell], Permissao apache Kill
I need to kill a lawsuit for php, but I use exec, system or exec_shell and it’s not killing the processes, I went online and the guys are saying that apache is not allowed to execute these kinds of…
-
1
votes1
answer28
viewsHow to reduce the time of creating and writing a Linux image for use in Rapsberrypi?
I’m resuming a project in which I need Rapsberrypi, but in the last attempt to create an image is to record it in Sdflash, using the DD command, the process took hours to complete, I ended up…
-
1
votes2
answers346
viewsShell Failure C#
Friends, I ask for help to solve a small problem. I am running SQL command through sqlcmd and Shell on C#, but the file is in a folder that contains "space", as follows. Path: D: Sandboxes\CIA…
-
1
votes1
answer194
viewsChange script variable value via Java application
I created a script where inside this script there’s a bond like while. The condition for that while is escolha != 1. Everything works ok, but in the middle of this while i run a Java application…
-
1
votes1
answer87
viewsHow can I find the user on Ubuntu (Shell/Bash)
I want to create a system that should interactively find the user and then say whether it exists or not. I must provide the username and if the user is found then the system has found the username…
-
1
votes1
answer287
viewsHow to recover a deleted file by "rm" command?
I deleted a file by accident via the command rm. Is there any way to get it back?
-
1
votes1
answer36
viewsUnderline between two variables
I have the following code in a file . sh: echo "$pasta/Dados/$MA/$ano\_$mes/$tabela" With all variables set correctly. However, running the script, echo results in…
-
1
votes1
answer309
viewsShell Script - Refresh page every 5 minutes
I need to update a web page (e.g., www.google.com) every 5 seconds because I have no idea how to do this script. someone can help me ? thank you
-
1
votes2
answers5127
views -
1
votes1
answer5766
viewsHow to know if the script command has been successfully executed?
I need the script to identify whether the tar.gz file was successfully generated in an if. Here’s a non-functional example: VAR=tar -zcf teste.tar.gz teste/testeDir if [VAR] then echo "Sucesso" else…
-
1
votes2
answers1282
viewsShell/Bash - Script continues before finishing the line that is running
I have a shell/bash script that works perfectly to make backups, the problem is that I have large files that are giving problems in the execution of the script. The script has to compress the file…
-
1
votes3
answers242
viewstable html shellscript
Guys, anyone who knows shellscript know how to create this requested script in the image below? I’m doing some exercises with the theme, and that kind of got me.…
-
1
votes1
answer107
viewsRoot permission to change date and time
I would like to know how to get my script to be allowed to change the date and time of the system without asking to enter the root password?