Skip to content

SysTutorials

  • Tutorials
  • Linux
  • Linux Manuals
  • Systems
  • Programming
  • Software
  • Subscribe
  • Search
SysTutorials

  • QA

    How to make sort using multiple threads to run faster?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    sort supports –parallel N to run N thread. However, it seems it only uses around 100% CPU as I observed although the command specified that N threads can be used. The command is as follows cat large-file | sort –parallel `nproc` where I have 16 from nproc. How to make sort use multiple threads to…

    Read More How to make sort using multiple threads to run faster?Continue

  • QA

    Any good Go REPL implementation / tool?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    Go lang is fast to compile and can be used as a script by go run prog.go. However, a REPL is more convenient for testing/trying some small pieces of code. Any good Go REPL implementation / tool? Try gore https://github.com/motemen/gore Get gore $ go get -u github.com/motemen/gore An example $ gore gore version 0.2.6 :help…

    Read More Any good Go REPL implementation / tool?Continue

  • QA

    How to convert svg to png in Linux?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    How to convert a svg image file to a high-quality png file in Linux? inkscape works great with vector images (better than ImageMagikk’s convert). Try this command to convert in.svg to a 1000×1000 png image: inkscape -z -e out.png -w 1000 -h 1000 in.svg

    Read More How to convert svg to png in Linux?Continue

  • QA

    Any good Java REPL tool/implementation?

    ByQ A Mar 24, 2018

    Any good suggestions on a Java REPL implementation like ‘scala’ and ‘python’ or ‘php -a’? The java-repl tool https://github.com/albertlatacz/java-repl/ works nicely for most situations for me. It is released as a .jar. Hence, it is easy to download and run: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar One usage example is as…

    Read More Any good Java REPL tool/implementation?Continue

  • QA

    How to put files with spaces in names into HDFS?

    ByQ A Mar 24, 2018

    I got this error when I tried to save a file with a space in its name into HDFS: $ hdfs dfs -put -f “/home/u1/testa/test a” “/u1/testa/test a” put: unexpected URISyntaxException while the HDFS seems allow spaces in its file names: https://hadoop.apache.org/docs/r2.7.3/hadoop-project-dist/hadoop-common/filesystem/model.html . How to achieve the effect of saving the files with spaces in…

    Read More How to put files with spaces in names into HDFS?Continue

  • QA

    How to process a file line by line in Python?

    ByQ A Mar 24, 2018

    In Python, how to process read a file line by line to process it? Like those lines in Bash: while read line ; do echo $line done < ./input.txt In Python, you can process a file line by line by a for in the file like with open(“./input.txt”, “r”) as thefile: for line in thefile:…

    Read More How to process a file line by line in Python?Continue

  • QA

    How to get hostname in Python on Linux?

    ByQ A Mar 24, 2018

    In Python, how to get hostname as the command hostname does on Linux? In Python, you can get the hostname by the socket.gethostname() library function in the socket module: import socket hostname = socket.gethostname() Reference: https://www.systutorials.com/dtivl/20/how-to-get-the-hostname-of-the-node?show=34#a34

    Read More How to get hostname in Python on Linux?Continue

  • QA

    How to get an environment variable in Go?

    ByQ A Mar 24, 2018

    In Go lang, how to get an environment variable? To get an environment variable (e.g. “VAR”) in GO: import “os” import “fmt” fmt.Println(“VAR:”, os.Getenv(“VAR”))

    Read More How to get an environment variable in Go?Continue

  • QA

    How to get an environment variable in Python?

    ByQ A Mar 24, 2018

    In Python, how to get an environment variable? In Python, you may use this piece of code to get an environment variable: os.environ.get(‘ENV_MIGHT_EXIST’) or this piece of code: os.getenv(‘ENV_MIGHT_EXIST’) It will return None if the environment variable is not present. Reference and for more ways, please check https://www.systutorials.com/dtivl/13/how-to-get-an-environment-variable?show=80#answer-80 .

    Read More How to get an environment variable in Python?Continue

  • QA

    How to effectively disable a Linux user account?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    Not yet to totally delete the Linux user account, but how to effectively disable a Linux user account? That is, disable a user account while keep all its files/configurations. Later, if it is needed, so that I can enable it again. To effectively disable a Linux user account so that it can’t login using its…

    Read More How to effectively disable a Linux user account?Continue

  • QA

    how to get the size of python file without using the os namespace

    ByEric Ma Mar 24, 2018Mar 24, 2018

    i need to create a program which is taking information from printer , so that i cannot use os namespace , so there is any way without using the os namespace You may use a way as follows. open the file seek to the end tell its position which is the file size An example…

    Read More how to get the size of python file without using the os namespaceContinue

  • QA

    How to convert a byte[] to io.Reader in Go?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    How to convert a byte[] to io.Reader in Go directly? You can use the NewReader() func from the bytes package of Go to convert bytes to io.Reader. For example, reader := bytes.NewReader(thebytes)

    Read More How to convert a byte[] to io.Reader in Go?Continue

  • QA

    How to read the whole file content into a string in Go?

    ByEric Ma Mar 24, 2018Mar 24, 2018

    How to read the whole file content into a string in Go? You can use the ReadFile() func from the io/ioutil package in Go to read the whole file content: func ReadFile(filename string) ([]byte, error) For example, read file filepath content and check the error: if bytes, err := ioutil.ReadFile(filepath); err != nil { log.Fatal(“Failed…

    Read More How to read the whole file content into a string in Go?Continue

  • QA

    How to do a good research in system field?

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    We may need to check some materials about how to do good research in system field if you a Ph.D. focusing on system research. Some references: 1, How to write a good systems paper 2, How to be a good graduate student 3, Doing a System Ph.D. 4, Giving an Academic Talk Welcome to add…

    Read More How to do a good research in system field?Continue

  • QA

    How to set process with lowest priority?

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    In system, sometimes, we need backstage threads with very very low priority since it cannot preempt any normal process asks for CPU. SCHED_IDLE class satisfies this requirement which has the priority lower than “nice=19” of CFS. Following code does this. 241 void set_idle_priority(void) { 242 struct sched_param param; 243 param.sched_priority = 0; 244 int s…

    Read More How to set process with lowest priority?Continue

  • QA

    How to use ioprio_set in linux c

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    Since there is no glibc wrapper for ioprio_set in linux c, we need to call this API with some definition. Using syscall in linux as follows. syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, IOPRIO_PRIO_CLASS(IOPRIO_CLASS_IDLE)); Some other definitions to declare above macros. 69 enum { 70 IOPRIO_CLASS_NONE, 71 IOPRIO_CLASS_RT, 72 IOPRIO_CLASS_BE, 73 IOPRIO_CLASS_IDLE, 74 }; 75 76 enum { 77…

    Read More How to use ioprio_set in linux cContinue

  • QA

    What is the vruntime of one process after it is moved into another run queue in Linux Kernel

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    When we do migration, one process will be migrated from one source CPU’s runqueue to destination CPU’s run queue. What is the virtual run time (if CFS is used) after it is moved into destination CPU’s run queue? When the process is dequeued from source CPU’s run queue, its vruntime will minus the minimum vruntime…

    Read More What is the vruntime of one process after it is moved into another run queue in Linux KernelContinue

  • QA

    Libvirt crash when upgrade from version 1.2.2 to version 2.5.0

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    If you install libvirt from ubuntu software library like this sudo apt-get install libvirt-bin The default version is 1.2.2 for Ubuntu Trusty. However, after you upgrade it to version 2.5.0 from its source codes (restart the libvirtd service), you will see following error if you want to install vm with virt-install. # ./installkvm1.sh Starting install……

    Read More Libvirt crash when upgrade from version 1.2.2 to version 2.5.0Continue

  • QA

    Cannot start VM with error “no network with matching name ‘default'”

    ByWeiwei Jia Mar 24, 2018Jan 7, 2020

    I update libvirt version and want to start VM with the new libvirt tools but I failed as follows. > sudo virsh start kvm1 error: Failed to start domain kvm1 error: Network not found: no network with matching name ‘default’ It seems that the default ‘virbr0’ is missing after I update libvirt so I solve…

    Read More Cannot start VM with error “no network with matching name ‘default'”Continue

  • QA

    Where to download an old release package of Hadoop?

    ByQ A Mar 24, 2018

    The download page of Hadoop http://hadoop.apache.org/releases.html only contains several recent release packages. I would like to download some old release packages such as Hadoop 2.5.0 which is not available anymore on the release page. Where to download a copy of the old release? You can download the old release packages of Hadoop on the http://archive.apache.org…

    Read More Where to download an old release package of Hadoop?Continue

Page navigation

Previous PagePrevious 1 … 15 16 17 18 19 … 70 Next PageNext

© 2026 SysTutorials

  • Tutorials
  • Linux
  • Linux Manuals
  • Systems
  • Programming
  • Software
  • Subscribe
  • Search