Most voted "unix" questions
Unix is a portable, multitasking, and multi-user operating system.
Learn more…45 questions
Sort by count of
-
15
votes4
answers309
viewsHow to deal with a comet process?
Analyzing the linux API I noticed that an interesting structure is possible: #include <unistd.h> #include <stdlib.h> int main() { while (1) { if (fork()) exit(0); // Altera meu pid…
-
11
votes2
answers2648
viewsWhat is a shebang?
Since in many languages the character # represents a committal, what is the sense of using it? He has some special sense?
-
10
votes1
answer3215
viewsPerform music in the program in C
I need to run a song while running a program in C. In Windows we can do so - if the file is in the same program directory: #include<stdio.h> #include<stdlib.h> int main (){ system("start…
-
7
votes2
answers623
viewsScript to find and replace words in multiple files
I need to make a command that finds and replaces a directory path by another path, in several HTML files, example of part of the HTML file: <DIV STYLE="margin-top:6pt;margin-left:36pt;" ><…
-
7
votes2
answers605
viewsWhy do I need './' to run Unix commands?
I noticed that every executable that I Gero I need for a ./ to run it on both Linux and Macos (Unix/Unix systems-like). For example, to compile a C file with GCC and run it right away, I do the…
-
6
votes2
answers12917
viewsWhat is the difference between a symbolic link and a hard link?
In the Unix context, what is the difference between a symbolic link (soft link) and a hard link and which commands are used to create them?
-
6
votes2
answers532
viewsAdvanced image optimization and compression on web servers without using external services
How to do even more optimized compression than you can achieve with tools like ImageMagick and libgd (GD) without generating WEBP image? Some services such as https://tinypng.com/ and…
image optimizing unix image-compression image-processingasked 9 years, 5 months ago Emerson Rocha 3,710 -
6
votes1
answer68
viewsWhat is the numbering next to the Unix commands?
I often see command descriptions like this: Like which(1) Unix command. Find the first instance of an Executable in the PATH. [Source] Or this: A cat(1) clone with Wings. [Source] What are these…
-
5
votes1
answer350
viewsHow to make a process wait for 'brothers'
Hello. I need to create a process tree, until the moment what I was able to do was create a side of the tree, kill everything and then create the other side. But I need to raise the whole tree first…
-
5
votes2
answers398
viewsConvert date to Unix timestamp
I have a table in a Mysql database that has a date column VARCHAR, guy 20-09-2017 and I need to migrate this column to a column bigint(8) using the date format timestamp unix. How to do this?…
-
4
votes2
answers2318
viewsExclude character in a given position?
How do I delete a certain character in a certain shell position? I’ve tried with sed, but I can’t get into position either, just the pattern. ",45123","B23142DHAS675" What I wanted was to erase the…
-
4
votes1
answer175
viewsProblem with echo` -e`
I’m starting to learn shell script and am doing some simple scripts to train. The script below tests whether whoever is running the script is logged in as root. # !/bin/bash # # This script test if…
-
4
votes2
answers295
viewsIn bash, what is the difference between a null string and an empty string?
I wonder if there is a difference in how bash represents variables with null values var= and with empty strings var="" What care should I take when manipulating variables like these?…
-
4
votes2
answers7992
viewsFind and Replace Multiple Words Inside a File
I want to develop a script which will replace any words in filing cabinet. I know what I can do with the command(s) below: $ tr 'ABC' '123' < arquivo.txt > novo-arquivo.txt or $ sed…
-
4
votes1
answer283
viewsHow to get different outputs (fasta) files with Unix or python
I have a fasta file that has several sequences of genes, like: >gene1 C.irapeanum 5.8S rRNA gene CGTAACAAGGTTTCCGTAGGTGAACCTGCGGAAGGATCATTGATGAGACCGTGGAATAAACGATCGAGTG >gene2 C.irapeanum 5.8S…
-
4
votes3
answers347
views -
3
votes1
answer1386
viewsFont Awesome appears as "blocks" in Nginx under Freebsd 10.1
I have a website that I have transported from Centos to Freebsd using rsync + mysqldump. Centos + Apache ran normal on Freebsd + Nginx gave this error: I believe it is related to this code that…
-
3
votes1
answer62
viewsHow do I publish my library to a linux repository?
I have developed a C library and I want to make it available to other developers. I wish this library could be installed using the command apt-get, for example: sudo apt-get install minhalib and in…
-
3
votes2
answers1000
viewsHow to get the pid of a windows process right after the process is run
How to get the pid of a windows process right after the process is executed, similar to the command $! that retrieves the pid from the process that was executed needed in a way to grab that pid from…
-
2
votes2
answers160
viewsWhat is the difference between open and opendir calls on UNIX?
If the open file uses the open system call, why is there another system call to open files directory (opendir), if a directory is a file type? It wasn’t supposed to be a call just for all kinds of…
-
2
votes1
answer244
viewsFour different conditions using awk if (Unix)
Hello I need to do an awk if command using 4 different conditions together, example of my input just for a few lines (I have an input with thousands of lines) chr17_30 1 chr1_72 0 chr1_46 2 chr1_47…
-
2
votes1
answer331
viewsComputer Date and Language Shell Script
Is there any shell script function that takes the date and time (time zone) and language that are configured on the computer?
-
2
votes2
answers116
viewsFormat columns - select specific information
Dear users, I have a large file with the following columns chr10_46938 EXON=28/28 STRAND=-1 ENSP=ENSGALP00000004070 SIFT=tolerated(0.38) chr10_46966 EXON=28/28 STRAND=-1…
-
2
votes1
answer38
viewsApropos for the Powershell
In Windows there is some solution in Powershell that can present some result of searching for similar commands to apropos unix?…
-
2
votes1
answer873
viewsdo Sort of a file with multiple columns
Hello need to do a Sort of my file, I have 3 columns: the first would be the chromosome (1,2,3,4,5.28,W,Z), the second would be the position on this chromosome and the last would be values. When I…
-
2
votes1
answer1888
viewsForbidden 403 apache2 on Ubuntu
Well this is the mistake I’m having with my apache. I changed my apache directory to: /media/marcelo/Arquivos/Google Drive/localhost and this directory has 777 permission. Forbidden You don't have…
-
2
votes0
answers22
viewsPAM Service - External LDAP authentication
Hello folks I need help, My application runs using a domain user and I need to access it through a webservice using this AD user with LDAP on linux, for this I am using PAM Service, I created the…
-
1
votes1
answer100
viewsRemotely access another Unix machine with Vim
According to this video https://www.youtube.com/watch?v=pN-GCcnI9Es it is possible to access another Unix machine with Vim and continue to edit the file from where I left off. Like I can do?…
-
1
votes1
answer132
viewsCross-platform C program
If I make a program in C and don’t use any Windows library leaving the program totally pure in C I can compile it for Linux as well? and will function normally?
-
1
votes1
answer97
viewsScript to swap place string with another string
I have the file /etc/udev/rules.d/70-persistent-net.rules that have such interfaces: SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:af:f7:e7:a4:3c", ATTR{dev_id}=="0x0",…
-
1
votes0
answers237
viewsLinux script to e-mail the result of the find command
I need a help in a script to send a result by email to a search (find) and run every day at 8:00 am without using contrab on linux
-
1
votes1
answer181
viewsUnix Command Grep output manipulation if no result is found
Good morning!! I am creating a script and I need that when I do a grep on a line and do not find it it return me the parameter I searched! grep "192.0.0.1 " /file.txt In the.txt file it does not…
-
1
votes3
answers1757
viewsProblem creating script . sh to enter a directory
I am creating a script. sh that the first step is to enter a directory. 1. #!/bin/bash cd /home/salariosbrasil/consulta-ninja #git pull pwd this directory exists and yet the cd doesn’t work.. but if…
-
1
votes1
answer38
viewsI need to delete the line that matches a word in the first file and also the second file in the sequence. How do I do?
I need to delete an entire line through a word that I will define and at the same time delete another line as well, but now it must be in another file that corresponds to the line of the first file.…
-
0
votes1
answer35
viewsrequest for support in optimization, fix shell command for mac
I am looking for the best way to optimize the following command shell in the Mac OSX, in order to fulfill the function that is intended which is basically to copy all files xx to the folder xx2:…
-
0
votes1
answer119
viewsDoubt with use of`pthread` in Posix
I am using the following routine with library command pthread.h: // // Declaração // pthread_t threads[NUM_THREADS]; // // Criacao // for(...) { pthread_create(&threads[i], NULL, MainTH, (void…
-
0
votes2
answers485
viewsSave txt file with windows encoding
My application runs on a Unix OS, so my files .TXT are created in UNIX format, I need these files to be created in WINDOWS format. I need the line breaks to be in WINDOWS format r n. I’m having…
-
0
votes0
answers39
viewsShel Script [Tail] Return line at the end of each concatenated fichier
Long live, I have several files with the same headers. what I wanted is to copy the contents of all files inside 1 only but only with 1 header. I’ve managed to do this part with the code below head…
-
0
votes1
answer266
viewsSED replace the same case and minuscule occurrences with something
I am trying to replace occurrences "strings that appear in the document" with another value in the '' case; I have the following chunk of shell script code mkdir NOVO for script in *.sql do sed…
-
0
votes1
answer153
views -
0
votes0
answers50
viewsCode with Sockets locking in the middle
Because of the matter of college networks, lately I have had experiences to learn how to deal with sockets in C. But today, trying to develop a game of sailing to practice, I went through a somewhat…
-
0
votes1
answer86
viewswhile read does not work in Unix shell script
I’m writing a script and using while read twice he makes the 1 only once: un=$(echo $LOGNAME | tr '[A-Z]' '[a-z]') grep -v '^#' nodeteste.txt > auxiliar.txt while read line do ssh "$un@$line"…
-
0
votes1
answer29
viewsWhy can’t I create an IPC key with the ~/. bashrc file?
I was working out some school exercises and in the statement there was a question: One can generate an IPC key with the file . bashrc? I not knowing the answer to the question, I created a C program…
-
-1
votes2
answers39
viewsShellscript for returning bank values each value in 1 different variable?
Hello I am trying to return 1 value for each variable I can return however, I am trying to create a condition that applies to one for which are true and which are false and display me on the screen…
-
-1
votes1
answer152
viewsSort timestamp results just by time?
I am trying to make a time ranking system of a game. The game uses UNIX time as a measure of time. I need to put the minor times first in ascending order, but as UNIX time includes date as well,…