# ssh root@192.168.122.96 root@192.168.122.96’s password: Permission denied, please try again. Do according to [1]. NOTE: on Ubuntu, remember to restart ssh service like this “sudo restart ssh”. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/v2v_guide/preparation_before_the_p2v_migration-enable_root_login_over_ssh
Category: Tutorial
How to apply the Email sort order to all folders in Evolution?
Posted onEvolution’s default Email sort order is not very convenient, at least to me. How to apply the settings of sort order for a folder to all folders in Evolution? Manually setting the email sort order for each dir is tedious. Evolution has a function to “apply the same view settings to all folder” so that
Read more
How to iterate all dirs and files in a dir in C++?
Posted onHow to iterate all dirs and files in a dir in C++? To open a dir, we can use opendir() to open a directory stream. DIR *opendir(const char *name); Then we can use readdir() to iterate the directory stream. struct dirent *readdir(DIR *dirp); Here is an example C++ program using these 2 library functions. #include
Read more
How to check CPU working frequency in iOS on iPhone?
Posted onHow to check CPU working frequency in iOS on iPhone, such as my iPhone 6? The Litum Info Lite free app (Litum Info full version app) can show you the info of CPU including its frequency. The CPU frequency: You can find the CPU info page from the menu:
How to unignore some files or dirs in git?
Posted onI set up rules to ignore all files under git by adding a .gitignore like * But how to unignore some files or dirs in git? For example unignore all files under ./bin/tool1/ under the git repository. You can use patterns with ! as the prefix to “unignore” files. From gitignore man page: An optional prefix “!”
Read more
How to remove newline characters from a string in C++?
Posted onHow to remove newline characters from a string in C++? For example, a string like line 1 line 3 line 4 should be converted to line 1line 3line 4 Method 1: use `erase()` and `remove()` In short, use this code snippet: input.erase(std::remove(input.begin(), input.end(), ‘\n’), input.end()); std::remove() shifts all elements that are equal to the value
Read more
How to get a path’s mtime in C++ on Linux?
Posted onHow to get a path’s mtime in C++ on Linux? The path can be a file or a dir. You may call the standard library function lstat() for the file or dir under the path. int lstat(const char *pathname, struct stat *statbuf); From the returned stat struct, there is a field st_mtim which is the
Read more
How to test whether a given path is a directory or a file in C++?
Posted onHow to test whether a given path is a directory or a file in C++? For example, pathtype(“/”) –> “a dir” pathtype(“/tmp/file.txt”) –> “a file” # if there is a file file.txt pathtype(“/tmp/dir.txt”) –> “a dir” # if there is a dir named dir.txt The type of a file/dir can be found out using lstat()
Read more
How to change the default target of `make`?
Posted onThe default target of make is the first target. But can I change the default target in Makefile and how to change the default target of make? The default goal of make is the first target whose name does not start with ‘.’ if .DEFAULT_GOAL is not set. Ref: make manual. To set the default
Read more
How to cat a single file’s content from a tar without unpacking it on Linux?
Posted onHow to cat a single file’s content from a tar without unpacking it on Linux? For example, I know there is a file README.txt in a tar tools.tar.gz . How to cat the content of README.txt out? You can do this by using a combination of tar‘s options and arguments. -O, –to-stdout Extract files to
Read more
What are the differences between BIOS and UEFI?
Posted onBIOS: Basic Input Output Systems UEFI: Unified Extensible Firmware Interface UEFI is the advanced BIOS, which solves some limitations in BIOS such as 1, 16-bit processor mode; 2, 1 MB addressable space and PC AT hardware. References: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface
how to list and delete shared memory in linux?
Posted onhow to list and delete shared memory in linux? List all shared memories in your Linux Systems > $ ipcs -m Delete specific one > $ ipcrm -M 0x0001869c
How to get one process’s port number?
Posted onIf we want to check one program on one remote server, we need to know this server’s IP and port number. How to get this program’s port number in the remote server? # netstat -tulpn Remember to run this program with root permission since some programs can only be accessed by root.
How to get a server’s serial number remotely?
Posted onHow to get a server’s serial number remotely? Tested on Linux Ubuntu 14.04 Trusty > sudo apt-get install dmidecode > sudo dmidecode -s system-serial-number I tried this on several Linux boxes with CentOS 7 and it seems A physical node returns a string like System Serial Number. A KVM VM returns a string like 3fd12bba-12d4-48c7-875a-7a5f57ed8a9a.
Read more
What are the differences between NUMA architecture and SMP architecture?
Posted onNUMA Architecture: Non-Uniform Memory Access architecture. SMP: Symmetric Multiprocessing architecture. In a Symmetric Multiprocessor, the architectural “distance” to any memory location is the same for all processors, i.e. “symmetric”. In a NonUniform Memory Access machine, each processor is “closer” to some memory locations than others; i.e. memory is partitioned among them Asymmetrically. From my understanding,
Read more
Latex is stuck with a strange problem, see more information for details.
Posted on$ make pdflatex main.tex This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex) restricted write18 enabled. entering extended mode (./main.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./usenix.sty (/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathptmx.sty)) (/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg) (/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
Read more
How to judge whether its STDERR is redirected to a file in a Bash script on Linux?
Posted onWithin a Bash script, how to judge whether its STDERR is redirected to a file in Bash on Linux? For example, ./script.sh /tmp/log 2>&1 Can script.sh detect that its STDERR is redirected? Knowing the destination file is better. To test whether a script’s STDERR (or STDOUT) is redirected to a file, check by [[ -f
Read more
Why do I need to run latex/bibtex three times to make everything look good?
Posted onWhy does latex need to be executed 3 times like following? pdflatex main.tex bibtex main pdflatex main.tex pdflatex main.tex Copied from https://tex.stackexchange.com/questions/53235/why-does-latex-bibtex-need-three-passes-to-clear-up-all-warnings. The reason is as follows: 1, At the first latex run, all cite{…} arguments are written in the file document.aux. 2, At the bibtex run, this information is taken by bibtex and the
Read more
How can I login without password and run command in server at a local machine remotely?
Posted onLogin without PWD is fast and efficient. Running commands in server from local machine also have these benefits. login without PWD: add PC A’s public key to PC B’s authorized keys. > a@A:~> cat .ssh/id_rsa.pub | ssh b@B ‘cat >> .ssh/authorized_keys’ > b@B’s password: Run command remotely ssh root@MachineB “ls” NOTE: running commands remotely is
Read more
diff alternative on Windows to find differences between 2 files?
Posted ondiff on Linux is a very handy tool. Any good diff alternatives on Windows to find differences between 2 files? A GUI program will be better on Windows. I would recommend meld for Windows users. Meld is a visual diff and merge tool open source software. meld is available on Linux, Windows and Mac OS
Read more