ALL


  How to use xargs command in Linux

What is the xargs command?The xargs command constructs and executes commands provided through standard input. It takes input and converts it into command arguments for another command. This functionality is particularly useful in file management and can be combined with commands like rm, cp, mkdir, and others.Using the xargs commandWhen used alone, the xargs command prompts the user to enter a text string and then passes it to the echo command.This example demonstrates the input provided and the output of the echo command.Combining xargs with findThe find command is often used in conjunction w...

3,387 0       LINUX XARGS


  Linux的早期岁月

我的名字是 Lars Wirzenius,我曾经见证了Linux的起点。Linux现在是一个全球成功的操作系统,但它的开始却非常谦逊。这些是我对Linux最早的日子、它的创造以及它走向今天的记忆。我于1988年秋季开始在赫尔辛基大学攻读计算机科学,并认识了 Linus Torvalds,他也是当年计算机科学专业的新生之一,而且和我一样说瑞典语。在那个学年的末尾,我们得到了一台Unix服务器的访问权限,然后我无意中发现了Usenet,这个讨论系统,因为我误将rm打成了rn,即Usenet阅...

1,597 0       LINUX HISTORY STORY


  A simple tutorial on Linux nohup command

In our daily work, there might be need to run some important program for hours or even days without being abruptly terminated. In such case, we may want to run the program with command nohup.nohup is the abbreviation of no hangup, i.e, don't hang up or terminate the process. This command will tell the process to ignore the system HUP signal. The HUP signal will be emitted when the terminal is exited or disconnected. Normally process will abort its execution when receiving this signal. Basic SyntaxThe basic syntax for nohup isnohup command argumentsornohup optionsIf you want to know more u...

1,869 1       LINUX NOHUP


  Find files by size in Linux

In Linux systems, you may encounter a situation where there is no enough space on the system while you are trying to install some new packages or writing some data. In this case, you may want to clear some unneeded files. A frequent need will be find the largest files in the system so that they can be deleted first and disk space can be released quickly.In this post, we will show a simple command to find files by size so that we know what files are taking the specified space on the system,This command to be introduced is find. Let's say we want to find the files which are larger than 500M, we ...

1,677 0       FILESIZE FIND LINUX


  Create temp file in Bash using mktemp and trap

When working on Linux Bash, sometimes there is need to create temporary file. A common way of creating temp file on Linux is creating some file in /tmp directory. However there is security risk when creating temp file in /tmp directory. This post will show how to securely create temp file in Linux Bash.When creating file in /tmp directory, there are some security risks. This directory can be accessed by any user on the system, any user can write data into this directory as well. The files created in this directory can also be read by other users. pike@DESKTOP-G352RBR:/tmp$ touch /tmp/info...

34,508 2       TEMP FILE MKTEMP TRAP LINUX


  Common usage of ls command in Linux

In Linux, ls might be one of the most frequently used commands. It is used to list files in a specific directory. In most cases, we may just use ls -l to list the files under a directory. But have you explored other usages of this command. In this post, we will summarise some other common usages of ls commandAssuming we have below directory structure in our system, let's see them using tree command.List details of the filesIf we want to list the details of the files in /home/alvin/test_dir, we can funls -lR /home/alvin/test_dir/Output:[alvin@VM_0_16_centos test_dir]$ ls -lR...

6,478 0       LINUX SHELL LS


  Difference between localhost and 127.0.0.1

Lots of people would think what the address 127.0.0.1 is when first seeing this address. In fact, 127.0.0.1 is a loopback address which refers to the local machine. It is generally used for local testing. When typing ping 127.0.0.1 on local command console, it will send network packets to local IP/TCP layer to test whether IP/TCP works properly or not. To those who are used to use localhost, it is actually mapped to 127.0.0.1 by default. There are hosts files in the system which store this mapping. Hence normally these two can be interchanged.# localhost name resolution is handled within ...

30,865 2       LINUX NETWORK LOCALHOST 127.0.0.1 LOCALHOST VS 127.0.0.1


  Shell script common interview questions

Shell script is frequently used when monitoring system status on Linux. It's not an easy task to write shell script but it's a very important skill for developers and system administrators to ease work and automate common tasks. This post will share some common interview questions about shell script.1. Get random characters(8 characters)Method 1# echo $RANDOM |md5sum |cut -c 1-8471b94f2Method 2# openssl rand -base64 4vg3BEg==Method 3# cat /proc/sys/kernel/random/uuid |cut -c 1-8ed9e032c2. Get random numbers(8 digits)Method 1# echo $RANDOM |cksum |cut -c 1-823648321Method 2# openssl rand -...

5,895 0       LINUX INTERVIEW SHELL SCRIPT