Most Popular
1500 questions
149
votes
6 answers
How does Linux handle multiple consecutive path separators (/home////username///file)?
I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a double '/ in the path. I know that bash doesn't care…
Falmarri
- 12,897
- 17
- 58
- 71
149
votes
10 answers
Username is not in the sudoers file. This incident will be reported
I am running Ubuntu 12.04 on my laptop using VMware Player. I am not sure why but I have an account called "User Account" in addition to my account that I usually login to use Ubuntu. Well that was just a side comment but basically all I am trying…
fsolano94
- 1,627
- 2
- 11
- 4
148
votes
5 answers
systemctl status shows : "State: degraded"
When I run systemctl status, I get State: degraded at the top,
● x230
State: degraded
Jobs: 0 queued
Failed: 1 units
Since: Wed 2018-05-30 17:09:49 CDT; 3 days ago
....
What's going on, and how do I fix it?
Evan Carroll
- 28,578
- 45
- 164
- 290
148
votes
6 answers
Why does Vim indent pasted code incorrectly?
In Vim, if I paste this script:
#!/bin/sh
VAR=1
while ((VAR < 10))
do
echo "VAR1 is now $VAR"
((VAR = VAR +2))
done
echo "finish"
I get these strange results:
#!/bin/sh
#VAR=1
#while ((VAR < 10))
# do
# …
elbarna
- 12,050
- 22
- 92
- 170
148
votes
13 answers
Show top five CPU consuming processes with `ps`
How to show top five CPU consuming processes with ps?
PlanasB
- 1,625
- 2
- 11
- 9
147
votes
4 answers
What is yum equivalent of 'apt-get update'?
Debian's apt-get update fetches and updates the package index. Because I'm used to this way of doing things, I was surprised to find that yum update does all that and upgrades the system. This made me curious of how to update the package index…
tshepang
- 64,472
- 86
- 223
- 290
147
votes
5 answers
Understanding the exclamation mark (!) in bash
I used
history | less
to get the lines of previous commands and from the numbers on the left hand side I found the line I wanted repeated (eg. 22) and did
!22
at the command prompt and it worked -- executing the set of commands on the line I did…
Vass
- 5,271
- 9
- 38
- 45
147
votes
6 answers
apache2 Invalid command 'SSLEngine'
When I restart httpd, I get the following error. What am I missing?
[root@localhost ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: Syntax error on line 22 of…
Christian
- 2,155
- 3
- 16
- 14
147
votes
2 answers
Create symlink - overwrite if one exists
I want to take down data in /path/to/data/folder/month/date/hour/minute/file and symlink it to /path/to/recent/file and do this automatically every time a file is created.
Assuming I will not know ahead of time if /path/to/recent/file exists, how…
drjrm3
- 1,885
- 4
- 16
- 17
147
votes
5 answers
Forward SIGTERM to child in Bash
I have a Bash script, which looks similar to this:
#!/bin/bash
echo "Doing some initial work....";
/bin/start/main/server --nodaemon
Now if the bash shell running the script receives a SIGTERM signal, it should also send a SIGTERM to the running…
Lorenz
- 1,573
- 2
- 10
- 5
147
votes
6 answers
How to comment multiple lines at once?
How can I select a bunch of text and comment it all out?
Currently I go to the first line, go to insert mode then type # left-arrowdown-arrow and then I repeat that sequence, perhaps saving a few keystrokes by using the . repeat feature to do each…
Michael Durrant
- 41,213
- 69
- 165
- 232
147
votes
13 answers
Replace space with new line
How can I replace spaces with new lines on an input like:
/path/to/file /path/to/file2 /path/to/file3 /path/to/file4 /path/to/file5 etc...
To obtain the following:
/path/to/file
/path/to/file2
/path/to/file3
/path/to/file4
/path/to/file5
Note
I'm…
laconbass
- 4,339
- 4
- 16
- 20
146
votes
9 answers
Exit vim more quickly
I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter.
How to quit Vim (possibly saving the document) with the least keystrokes?…
deprecated
- 2,841
- 4
- 24
- 22
146
votes
10 answers
How to output only file names (with spaces) in ls -Al?
I should echo only names of files or directories with this construction:
ls -Al | while read string
do
...
done
ls -Al output :
drwxr-xr-x 12 s162103 studs 12 march 28 12:49 personal domain
drwxr-xr-x 2 s162103 studs 3 march…
Alex Zern
- 1,669
- 3
- 13
- 8
146
votes
2 answers
How to show the filesystem type via the terminal?
Possible Duplicate:
How to tell what type of filesystem you’re on?
Find filesystem of an unmounted partition from a script
How can I quickly check the filesystem of the partition? Can I do that by using df?
tux_drummer
- 1,803
- 5
- 18
- 14