Tag: unix

60 votes
29 answers
1.5K views
Argument list too long error for rm, cp, mv commands

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars

avatar
Frederick
0 1 0 9
asked 07 September, 2021
65 votes
2 answers
2.2K views
How do SO_REUSEADDR and SO_REUSEPORT differ?

The man pages and programmer documentations for the socket options SO_REUSEADDR and SO_REUSEPORT are different

avatar
Thurman
0 1 0 9
asked 07 September, 2021
57 votes
27 answers
1.5K views
Convert DOS line endings to Linux line endings in Vim

If I open files I created in Windows, the lines all end with ^M. How do I delete these characters all at once?

avatar
Daniel
0 1 0 9
asked 07 September, 2021
55 votes
14 answers
550 views
How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory.

avatar
Keila
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
2K views
How to get full path of a file?

Is there an easy way I can print the full path of file.txt ? file.txt = /nfs/an/disks/jj/home/dir/file.txt

avatar
Boyd
0 1 0 9
asked 07 September, 2021
51 votes
28 answers
1.9K views
Using ls to list directories and their total sizes

Is it possible to use ls in Unix to list the total size of a sub-directory and all its contents as opposed to

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
66 votes
14 answers
976 views
What is the meaning of "POSIX"?

What is POSIX? I have read the Wikipedia article and I read it every time I encounter the term. The fact is th

avatar
Freida
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
1.6K views
How to kill a process running on particular port in Linux?

I tried to close the tomcat using ./shutdown.sh from tomcat /bin directory. But found that the server was not

avatar
Venice
0 1 0 9
asked 07 September, 2021
65 votes
15 answers
1.2K views
Looping through the content of a file in Bash

How do I iterate through each line of a text file with Bash? With this script: echo "Start!" for p in (pepti

avatar
Eddie
0 1 0 9
asked 07 September, 2021
49 votes
26 answers
489 views
How do I grep recursively?

How do I recursively grep all directories and subdirectories? find . | xargs grep "texthere" *

avatar
Chaya
0 1 0 9
asked 07 September, 2021
62 votes
22 answers
743 views
Use grep --exclude/--include syntax to not grep through certain files

I'm looking for the string foo= in text files in a directory tree. It's on a common Linux machine, I

avatar
Venice
0 1 0 9
asked 07 September, 2021
56 votes
10 answers
2.9K views
How do I pause my shell script for a second before continuing?

I have only found how to wait for user input. However, I only want to pause so that my while true doesn't

avatar
Benton
0 1 0 9
asked 07 September, 2021
66 votes
12 answers
2.5K views
Difference between sh and bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know wha

avatar
Luis
0 1 0 9
asked 07 September, 2021
62 votes
18 answers
399 views
In the shell, what does " 2>&1 " mean?

In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
1.6K views
How can I check if a directory exists in a Bash shell script?

What command can be used to check if a directory exists or not, within a Bash shell script?

avatar
Louetta
0 1 0 9
asked 07 September, 2021
67 votes
11 answers
2.1K views
How to pretty print XML from the command line?

Related: How can I pretty-print JSON in (unix) shell script? Is there a (unix) shell script to format XML in

avatar
Emilia
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.6K views
How to fix npm throwing error without sudo

I just installed node and npm through the package on nodejs.org, and whenever I try to search or install somet

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021