Questions tagged [centos]
Community ENTerprise Operating System; a Linux distribution based on Red Hat Enterprise Linux widely used on web servers.
3,217
questions
206
votes
11
answers
41k
views
I accidentally typed password into bash command line
I accidentally typed my password into bash command line, mistaking the Last login: ... line for Wrong password (I was in a hurry). What do I do to cover my trace?
What I did was editing .bash_history ...
159
votes
2
answers
315k
views
create tar with multiple directories and file locations
I have some scripts and files located in various locations like:
/etc/dir1
/var/www/html
/home/somedir
I want to make a tar file so that it copies files and folders with the location structure. ...
106
votes
4
answers
479k
views
Checking what PHP version I'm running on Linux?
I'm running Centos 5 and I need to know what version of PHP I'm running, is there a command for this which I can run?
93
votes
4
answers
178k
views
yum install gcc-g++ doesn't work anymore in CentOs 6.4
Today installed CentOs 6.4 fresh new on my workstation.
I wanted to install g++. With my surprise I didn't succeed by using
yum install gcc-g++
The thing is that even by doing a search I don't ...
92
votes
8
answers
212k
views
How to Install gcc 4.7.x/4.8.x on CentOS
What would be the easiest way to install gcc 4.7.x/4.8.x on a system with CentOS 6.2+? The default RPM package contains an older version of gcc.
69
votes
5
answers
280k
views
xrdp session: Login failed for display 0
I have just installed xrdp on my CentOs 7 following the steps in this article but could get as far as inputting my user name and password.
Here's a screenshot of the error that I get after trying to ...
67
votes
4
answers
150k
views
CentOS 7 VirtualBox no internet access
I am having trouble connecting my CentOS 7 guest to the internet. My VirtualBox Network configuration is as follows:
Adapter 1: NAT; Adapter 2: Host-Only (vboxnet0)
vboxnet0 is connected set up with ...
64
votes
4
answers
185k
views
Bidirectional clipboard not working in VirtualBox
I'm using VirtualBox Version 5.2.6 r120293 (Qt5.6.1).
Guest OS: Windows 7 Ultimate (32-bit)
Host OS: CentOS 7
I tried enabling bidirectional clipboard by going to Settings -> General -> Advanced and ...
62
votes
9
answers
205k
views
How to stop kernel messages from flooding my console?
I'm using Centos 6, rsyslog logging. Console is flooded with kernel messages.
Klogd is not running (I'm using rsyslog)
Rsyslog config does not direct anything to the console
Even tried stopping ...
61
votes
5
answers
552k
views
SSH permission denied on correct password authentication
I could successfully SSH into my machine yesterday with the exact same credentials I am using today. The machine is running CentOS 6.3. But now for some reason it is giving me permission denied.
Here ...
59
votes
4
answers
129k
views
What is the difference between CentOS "DVD" vs "Everything" ISOs
What is the difference between the DVD ISO and the Everything ISO? These options are presented on the CentOS download page but there is no explanation as to what the difference is.
53
votes
3
answers
115k
views
Difference between ${} and $() in a shell script
$ echo $(date)
Thu Jul 2 16:33:11 SGT 2015
$ echo ${date}
$ name=foo
$ echo $(name)
ksh: name: not found
$ echo ${name}
foo
Seems like ${variable} is the same as $variable, while $() is to execute ...
52
votes
1
answer
97k
views
What is run-parts in /etc/crontab and how do I use it?
I have been digging through my Linux system to try and understand how it all works.
In the /etc/crontab file I see the following:
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root ...
48
votes
8
answers
116k
views
How to combine the 'tar' command with 'find'
The find command gives this output:
[root@localhost /]# find var/log/ -iname anaconda.*
var/log/anaconda.log
var/log/anaconda.xlog
var/log/anaconda.yum.log
var/log/anaconda.syslog
var/log/anaconda....
47
votes
8
answers
288k
views
How do you automatically detect a new network card in CentOS 6 / RedHat?
I'm using CentOS 6 in a virtual environment. When cloning a virtual version of CentOS, the old eth adapters are "removed" and replaced with new ones and net MAC addresses. However, the ifcfg-ethn ...
46
votes
7
answers
136k
views
How to automatically run commands on SSH login?
Whenever I login to my Linux server I'd like to have several commands run automatically (set some variables, change location, etc.)
This needs to be done on user login, not on system start.
How can ...
46
votes
13
answers
187k
views
what causes “systemd: Failed at step USER spawning /usr/sbin/opendkim: No such process”
How can I remove following error:
systemd: Failed at step USER spawning /usr/sbin/opendkim: No such process
It occurs when I try to start opendkim service on Centos.
43
votes
10
answers
191k
views
How can I add additional search domains to the resolv.conf created by dhclient in CentOS
When my CentOS virtual machine boots it uses DHCP to get an IP address. It also overwrites resolv.conf with the DNS settings provided by the DHCP server. The DHCP server doesn't supply any search ...
42
votes
5
answers
97k
views
How to view history of Yum commands (update, install, remove)?
I'm seeing some errors in my apache logs and they may (or may not)
be related to some packages that I recently installed/removed using Yum.
Is there a way to view the history of Yum packages that ...
42
votes
4
answers
221k
views
Where Linux places the messages of boot?
I want to find place to where Linux writes all boot messages. You know:
facility one [STARTED]
facility two [STARTED]
facility three [FAILED]
I searched with
find . -print0 | xargs -0 grep -...
40
votes
6
answers
139k
views
yum hangs and won't respond
I am running yum check-update and it freezes after a 2 lines of output:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
I'm not sure what is happening. The last things I ...
38
votes
1
answer
12k
views
Why is unzipped directory much smaller (4.0 K) than zipped (73.0 G)?
I unzipped a zipped file using zip -l <filename> but what get is a dir much smaller than what it was before unzipping. Unzipped dir has all the files mostly videos. Why is the unzipped ...
36
votes
6
answers
173k
views
How to disable ipv6 on a specific interface in Linux?
Could someone tell me how to disable ipv6 auto-config on a specific network interface in CentOS?
The current situation is:
A PC has two network adapters eth0 and eth1 that are connecting to the same ...
36
votes
6
answers
79k
views
To use ssh-id-copy do you need both id_rsa.pub and id_rsa?
I am trying to setup a second access ssh key for a friend. He sent me his id_rsa.pub.
ssh-copy-id -i id_rsa.pub [email protected]
/usr/local/bin/ssh-copy-id: ERROR: failed to open ID file './...
33
votes
5
answers
140k
views
Where to find SSH Login log files on centos
I have shared a .pem file with few a developers and now something went wrong on the server. I would like to track logins in a log so that I can see who (IP) made changes and when (if even possible) ...
33
votes
8
answers
91k
views
Are we supposed to manually delete the contents of /tmp?
I was under the impression that “old” files in /tmp will be regularly deleted. However, it seems to me that /tmp will just grow as long as it wants to, and nothing will be deleted. Some people say it’...
31
votes
6
answers
74k
views
Check if a DHCP server existing in my network using bash
using CentOS with static IP, Is there any way to determinate if a DHCP server running on the network using bash ?
31
votes
3
answers
32k
views
sshfs is failing with "remote host has disconnected"
I'm running sshfs with the following:
sshfs [email protected]:/var/www/myapp /home/basicuser/code -o sftp_server="/usr/bin/sudo /usr/libexec/openssh/sftp-server"
I have also created RSA keys ...
30
votes
3
answers
95k
views
systemctl access denied when root
When I run
sudo systemctl disable avahi-daemon.socket
I get
Failed to execute operation: Access denied
But it's run as root, how can access be denied? (CentOS 7)
30
votes
3
answers
15k
views
What is difference between xargs with braces and without in Linux?
I want to know what is the difference between this
ls | xargs rm
ls | xargs -i{} rm {}
Both are working for me
29
votes
3
answers
19k
views
Install emacs without sudo?
I have been using vim for years, and I don't really like it.
I'd like to try emacs for a while, but it's not installed on any of the linux servers I use regularly. I don't have root so apt-get ...
28
votes
4
answers
186k
views
Adding --no-check-certificate to yum repositories
I have added virtio-win.repo according to this guide. The content of /etc/yum.repo.d/virtio-win.repo is now
[virtio-win-stable]
name=virtio-win builds roughly matching what was shipped in latest RHEL
...
28
votes
3
answers
142k
views
How to find which files and folders were deleted recently in Linux?
I am having one particular folder (/home/sam/officedocuments) which is having hundreds of folders and files.
I think I deleted some files and folders by mistake but I'm not sure.
How to find which ...
27
votes
3
answers
156k
views
How to completely uninstall a package (including all extra files that came with it) using yum (or rpm)?
When I do yum remove, it sometimes keeps a package's configuration files.
Is there anyway to remove a package completely, without keeping any file that belonged to the package?
I am running CentOS.
26
votes
4
answers
38k
views
How to find which package certain command belongs to on CentOS?
For example I can easily find locate command belongs to mlocate.i386 package.
yum search locate
mlocate.i386 : An utility for finding files by name
[mirror@home /]$ rpm -qa | grep locate
mlocate-0.15-...
25
votes
4
answers
192k
views
Centos 7 - ping 8.8.8.8 (connect: Network is unreachable)
I think I have a routing problem. I have set up a CentOS VM, it is connected to my network and I can ping other machines.
I cannot however ping anything outside of my network.
[root@localhost ~]# ...
24
votes
10
answers
150k
views
How to install pip and easy_install on CentOS
I tried to install pip and easy_install on my CentOS but could not find them.
How can I install them?
Also, I have two versions of Python, 2.4 and 2.7. How will pip make sure to link newly installed ...
24
votes
2
answers
30k
views
tail/head all line except X last/first Lines
for example i have this file :
cat myfile
1
2
3
4
5
i want to print all lines except first 2 line . output should be like this :
tail -n $(( $(wc -l myfile | awk '{print $1}') - 2 )) myfile
3
4
5
...
23
votes
1
answer
23k
views
Remove port aliases in iptables
How can I make iptables show me port numbers instead of aliases for well known port numbers (eg. http for 80, https for 443 etc.). Is there a way to make it show just port numbers at all times?
22
votes
1
answer
165k
views
How to know the directory size in CENTOS [duplicate]
I have a website on my server and I own it.
The size of the website is around a whopping 170GB. This shouldn't be this much. At most, it should be around 20GB. I don't know what makes it that big.
I ...
22
votes
4
answers
8k
views
Moving 2TB (10 mil files + dirs), what's my bottleneck?
Background
I ran out of space on /home/data and need to transfer /home/data/repo to /home/data2.
/home/data/repo contains 1M dirs, each of which contain 11 dirs and 10 files. It totals 2TB.
/home/...
21
votes
2
answers
86k
views
How to chown directory for multiple users?
Specs:
Running Centos 6
64 Bit
I am trying to chown a directory for all users on the VPS, aswell as for apache. But for some reason I can only have either apache, or just the users.
I tried doing ...
21
votes
5
answers
25k
views
Execute a command if Linux is idle for 5 minutes
I would like to execute a command such as
notify-send 'a'
if my Linux machine has been idle for 5 minutes.
By idle, I mean the same thing a screen saver that gets activated would use to define "...
20
votes
3
answers
36k
views
how to stop cp: overwrite './xxx' ? prompt
How can I stop the cp command from prompting to overwrite. I want to overwrite all the files with out having to keep going back to the terminal. As these are large files and take some time to complete....
20
votes
3
answers
17k
views
Is sendmail an smtp server? Is there any difference between MTA and mail server?
I am new to mail and do not exactly know how it works.
I have seen administrators use sendmail to send out email. Is sendmail an smtp server or is it a client that relies on smtp server to relay ...
20
votes
3
answers
29k
views
How can I perform a full texlive installation (all packages) in CentOS?
Title say it all, how can I install texlive and all the packages so I can run tex2pdf on CentOS? I'm rather used to Ubuntu and all this yum business is driving me nuts.
20
votes
1
answer
77k
views
How do I copy/paste into a minimal installation of CentOS on VirtualBox?
I am trying to copy&paste from my local Windows machine into my CentOS guest machine, running on VirtualBox. The CentOS installation is minimal (only the console).
I followed this guide, and ...
19
votes
5
answers
91k
views
How to run a script on CentOS Linux startup
I put one script in /etc/init.d/abc.sh. Now I want it to run at startup.
How can I do that with chkconfig?
chkconfig --add abc.sh
But I am not sure how it works.
19
votes
3
answers
31k
views
What does an empty iptables mean?
I’m using CentOS and when type in the following iptables command:
iptables -L -v
The output is as follows:
Chain INPUT (policy ACCEPT 19614 packets, 2312K bytes) pkts bytes target prot opt in ...
18
votes
4
answers
123k
views
How can I determine the MAC address for a NIC in CentOS without using ifconfig?
CentOS 5.5
One of my CenTOS systems recently booted with the following error:
"Bringing up interface eth0: Device eth0 has difference MAC address than expected. ignoring."
When I run ifconfig -a ...