How to find the disk where root / is on in Bash on Linux?

Posted on

Question: how to find the disk where the Linux’s root(/) is on in Bash? The root may be on a LVM volume or on a raw disk. 2 cases: One example: # df -hT | grep /$ /dev/sda4 ext4 48G 32G 14G 71% / For another example: # df -hT | grep /$ /dev/mapper/fedora-root ext4
Read more

How to get the hostname of the node in C++?

Posted on

In C++, how to get the hostname of the node? In C++, the C way works too. However, with Boost, you can use the boost::asio::ip::host_name() function to get the hostname as a std::string: namespace boost { namespace asio { namespace ip { /// Get the current host name. BOOST_ASIO_DECL std::string host_name(); … More at http://www.boost.org/doc/libs/1_63_0/boost/asio/ip/host_name.hpp
Read more

How to get hostname in Python on Linux?

Posted on

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

How to get an environment variable in Python?

Posted on

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 .

How to set process with lowest priority?

Posted on

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 redirect non-www domain to www domain in .htaccess?

Posted on

I have a website. But I would like use the www.example.com instead of example.com. How to redirect non-www domain to www domain on my server? I am using apache2 (httpd). You can add a piece of code into the top .htaccess in your site: Specific method: redirect example.com domain to www.example.com domain RewriteEngine On RewriteBase
Read more

how to use pc internet of window8 on iphone 4s via usb

Posted on

how to use pc internet on iPhone 4s wia usb cable, pc is of window 8 and in network setting its not showing of connection of I phones network I ever wrote a tutorial at http://www.systutorials.com/136003/iphone-connecting-internet-using-windows-pc-network-through-usb-cable/ . But please be aware that it worked only on specific OS combinations. So, I am not sure whether
Read more

How to get the metadata of an AWS S3 object?

Posted on

I upload files using the aws cli http://www.systutorials.com/239665/uploading-large-files-amazon-s3-aws-cli/ . But how to get the metadata of an object in AWS S3? You can use the s3api‘s head-object command to get the metadata of an object. Taking one example: $ aws s3api head-object –bucket test-hkust –key dir2/fileupload/fb0c6353-a90c-4522-9355-7cd16cf756ff.file.txt It will print results like { “AcceptRanges”: “bytes”, “ContentType”:
Read more

how change my policy of scheduling in hadoop?

Posted on

I want to change policy of scheduling in Hadoop, how to I can change job order in map reduce automatically. Assume you are using Hadoop 2 / YARN. The configuration parameter named yarn.resourcemanager.scheduler.class controls the class to be used as the resource scheduler for YARN/Hadoop. The default value for the scheduler class (check more at
Read more

How to get a script’s directory reliably in Bash on Linux?

Posted on

How to get a script’s directory reliably in Bash on Linux? For example, to get the directory of the executing script $0. dirname can give you the directory name from the absolute path. You can get the absolute path of the script by readlink -f to handle symbolic links (consider a symbolic link ./run.sh linked
Read more

How to install Windows from USB drive?

Posted on

I have downloaded the iso file of Windows 10 installation disk from https://www.microsoft.com/en-us/software-download/windows10ISO . But I do not have a DVD R/W drive. Whether and how to install Windows from a USB drive? You can use the Windows USB/DVD Download Tool to make a USB from the Windows ISO. Download and install the Windows USB/DVD
Read more

Free VNC server software on Windows

Posted on

RealVNC only gives free version to personal usage of their server software while it limits the functions. Could you suggest some good free VNC server software with full functions? TightVNC is an open-source software for VNC with servers and clients. You can download the server software for Windows from TightVNC download page: http://www.tightvnc.com/download.php The software
Read more

How to install Chrome on Fedora Linux?

Posted on

How to install the Chrome browser on Fedora Linux from Google? Google provides a repository for yum/dnf on Fedora. First, following http://www.systutorials.com/3471/additional-repositories-for-fedora-linux/#google-chrome-repository to add Google Chrome repository. Then, you can install Google Chrome by yum/dnf: # dnf install google-chrome-stable

How to open a URL in a new window in JavaScript?

Posted on

How to open a URL in a new window in JavaScript? For example, to open a new window to browse “http://www.systutorials.com“. Open the URL in a new window: url = “http://www.systutorials.com”; window.open(url); Some browser will open the window in a new tab depending on the configuration. If you want to force the browser to open
Read more