How to set up HP printer and scaner on CentOS 7?

Posted on

How to set up the driver for an HP all-in-one printer/scanner on CentOS 7 Linux? First, install these packages and it may ask you to download and install other plugins. Without these packages, my printer does work. # yum install hplip hplip-gui hpijs Second, install plugins for the HP printer. # hp-plugin Then you can
Read more

How to detect whether a file is readable and writable in Python?

Posted on

Before reading or writing a file, access should be checked first. How to detect whether a file is readable and writable in Python? You can use the os.access(path, mode) library function https://docs.python.org/release/2.6.6/library/os.html#os.access like the Linux access library function for C. It returns True if access is allowed, False if not. For readable and writable, you
Read more

How to handle spaces in paths with rsync on Linux?

Posted on

The common rsync commands seems not handle spaces well. For example, rsync -avxP file “user@server:/data/my dir” It reports: rsync: link_stat “/home/zma/file” failed: No such file or directory (2) How to make rsync handle spaces well? You can use the –protect-args option of rsync. $ rsync –protect-args -avxP file “user@server:/data/my dir” What does –protect-args do: -s,
Read more

How to install sshfs on CentOS 7?

Posted on

sshfs is a nice tool. But it seems there is no support to it in a newly installed CentOS 7 Linux system: Not installed by default: # sshfs -bash: sshfs: command not found Seems not available from the repositories # yum install sshfs -y Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron?
Read more

How to make Ubuntu Linux boot to text mode?

Posted on

My Ubuntu boots to GUI mode by default. How to make Ubuntu Linux boot to text mode? If you are using Ubuntu older than 16 such as Ubuntu 14.04: Edit /etc/default/grub Change GRUB_CMDLINE_LINUX=… to GRUB_CMDLINE_LINUX=”text”. Backup your old grub config`$ sudo cp -n /etc/default/grub /etc/default/grub.bak-date +%s ` Update grub$ sudo update-grub If you are using
Read more

How to change CONFIG_HZ parameter for Linux Kernel

Posted on

If we want to change the tick time for Linux Kernel, we need to change CONFIG_HZ parameter in Linux Kernel. Do we have other better ways to change it rather than compiling Linux Kernel. Please ignore the way to add ‘divider=10’ in grub config file because it is limited only for RH/CentOS distros. Zhiqiang, please
Read more

How to install aclocal on Fedora Linux?

Posted on

I tried to build a project while it reports: # ./autogen.sh Can’t exec “aclocal”: No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326. autoreconf: failed to run aclocal: No such file or directory How should I handle this? How to install aclocal? yum install aclocal shows: No package aclocal available. Error: Unable to find a
Read more

rtl8192cu driver for CentOS 7

Posted on

I find the rtl8192cu wireless adapter driver on CentOS 7 is quite unstable. After running a while, the connection will disappear. How to make it stable? There is a bug in some hardware where the device never wakes back up. You may try disabling the power management by putting a file 8192cu-disable-power-management.conf under /etc/modprobe.d/: #
Read more

Allowing root Access to NFS Directories

Posted on

For local filesystems, root usually has full access (read/write) to directories/files inside of it. But for NFS directory mounted from network, root usually has no permission to write to directories or files within the NFS directory. How to make root act similarly in an NFS directory to the behavior in local directories? The reason that
Read more

How to install glibc, glibc-common and GD libraries independently?

Posted on

I already have PHP and nginx installed and running on my on centOS 6.7. Please guide me, how can install glibc, glibc-common and GD libraries independently on my centOS 6.7 without crashing my system? I am not sure how you installed PHP and nginx. If they are installed from CentOS6.7’s Yum repository, you may install
Read more

Why I got message “invalid syntax, continuing…” when I execute “sysctl”?

Posted on

When I tried to apply new configuration in /etc/sysctl.conf, I got following message. warning: /etc/sysctl.conf(44): invalid syntax, continuing… Sounds like your changed /etc/sysctl.conf has problem. You may post the content of your /etc/sysctl.conf here to let other have a check. net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1
Read more

Converting Error to String in Go Lang

Posted on

In Golang, fmt.Println(err) can print out the error err. But how to convert an error to a string explicitely? In Go, the error type is an interface type that has an interface type error interface { Error() string } An error variable represents any value that can describe itself as a string. Ref: https://golang.org/pkg/builtin/#error So,
Read more