Most Popular
1500 questions
79
votes
2 answers
Output from ls has newlines but displays on a single line. Why?
I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line.
Can anyone explain this to me? I had always…
theconnorpower
- 1,009
- 1
- 7
- 8
78
votes
5 answers
So what are logical cpu cores (as opposed to physical cpu cores)?
I was googling about how I could find the number of CPUs in a machine and I found some posts but I am confused as some mentioned that you get the logical cores vs physical cores etc.
So what is the difference between logical and physical cores and…
Jim
- 9,750
- 15
- 57
- 84
78
votes
3 answers
What's the difference between single and double equal signs (=) in shell comparisons?
Read that for comparing strings inside if we need to use double square brackets. Some books says that comparison can be done by =. But it works with the == too.
#!/bin/bash
a="hello"
b="world"
if [[ $a == $b ]];then
echo "equal"
fi
Is there a…
user3539
- 4,288
- 9
- 34
- 44
78
votes
4 answers
grep lines starting with "1" in Ubuntu
I try to search for lines that start with "1" using
ls -1 | grep ^1*
but it returns lines that do not start with 1. What I am missing here?
Tim
- 98,580
- 191
- 570
- 977
78
votes
3 answers
sshfs mount, sudo gets permission denied
I am using sshfs to mount a folder with some python projects over ssh to my ~/ directory.
$ mkdir -p ~/mount/my-projects
$ sshfs [email protected]:/home/user/my-projects ~/mount/my-projects
I can perform most commands as could be expected:
$ ls…
Uyghur Lives Matter
- 1,656
- 3
- 22
- 31
78
votes
10 answers
Converting colored output into html
There are tools providing coloured output:
dwdiff -c File1 File2 # word level diff
grep --color=always # we all know this guy
...
The question is: How to convert their colored output of arbitrary program into coloured html file?
Other output…
Grzegorz Wierzowiecki
- 13,865
- 23
- 89
- 137
78
votes
10 answers
View pdf file in terminal
I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.
How can I view a pdf file in my terminal?
bioinformatician
- 963
- 1
- 6
- 9
78
votes
12 answers
Mount Google Drive in Linux?
Now that Google Drive is available, how do we mount it to a Linux filesystem? Similar solutions exist for Amazon S3 and Rackspace Cloud Files.
blee
- 1,322
- 2
- 11
- 14
78
votes
2 answers
Need explanation on Resident Set Size/Virtual Size
I found that pidstat would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is some example output:
02:34:36 PM PID minflt/s majflt/s VSZ RSS %MEM Command
02:34:37 PM …
Flanfl
- 955
- 1
- 8
- 5
78
votes
9 answers
Correctly determining memory usage in Linux
I'm a bit confused on some of the results I am seeing from ps and free.
On my server, this is the result of free -m
[root@server ~]# free -m
total used free shared buffers cached
Mem: 2048 2033 …
GoldenNewby
- 940
- 1
- 7
- 7
78
votes
4 answers
How to OCR a PDF file and get the text stored within the PDF?
First, apologies if this has been asked before - I searched for a while through the existing posts, but could not find support.
I am interested in a solution for Fedora to OCR a multipage non-searchable PDF and to turn this PDF into a new PDF file…
ingli
- 1,665
- 1
- 15
- 33
78
votes
1 answer
What is the difference between a name and a label in gparted?
When I create a new partition on my disk using GParted, I have the option to set both a name and a label. Some partitions I have already have both, some only a label. If I right-click on an existing partition, I can see separate options to set the…
user168419
78
votes
6 answers
What is the correct way to view your CPU speed on Linux?
I found two commands to output information about my CPU: cat /proc/cpuinfo and lscpu. /proc/cpuinfo shows that my CPU speed is 2.1 Ghz, whereas lspcu says it is 3167 Mhz. Which one is correct?
This is my exact output from cat /proc/cpuinfo about my…
Rohan
- 3,491
- 9
- 28
- 45
78
votes
4 answers
$@ except the 1st argument
I need to write a shell script that runs in this way:
./myscript arg1 arg2_1 arg2_2 arg2_3 ....... arg2_#
there is a for loop inside script
for i in $@
However, as I know, $@ includes $1 up to $($#-1). But for my program $1 is distinctly…
user40780
- 1,841
- 4
- 14
- 15
78
votes
6 answers
How to determine the maximum number to pass to make -j option?
I want to compile as fast as possible. Go figure. And would like to automate the choice of the number following the -j option. How can I programmatically choose that value, e.g. in a shell script?
Is the output of nproc equivalent to the number…
tarabyte
- 4,166
- 10
- 36
- 48