This problem always occurs when Ubuntu starts MONGO recently
root@ubuntu:/var/lib/mongodb# MONGO
MongoDB shell version:2.0.4
connecting to:test Tue 7 06:13:34 error:couldn ' t connect to server 127.0.0.1 shell/mongo.js:84
Exception:connect failed
The most crude version
Shell Code
Find. -name "*.java" |xargs wc-l|grep "Total" |awk ' {print $} ' find
.-name "*.java" |xargs cat|wc-l #Output: 37634
The above two sentences are the same, but the second one is to use cat to merge the
Here document is one of the ways in which you define block variables in bash.
The form of the definition is:
Command
...
...
...
HereIts role can be used to define a variable, the command and the content between here using the way to input to the
A simple description of the process of writing a shell script in Linux
1, use VIM or gedit to create a file, usually use. sh as a file suffix
2, "#!/bin/bash" as the first line of statements, which "#!" Known as the "Sha-bang" symbol, is the
Background information:
The project has two log folders, one for Tomcat itself, and two for the project.
This script is used in conjunction with Crontab once a week and can be done without restarting the Tomcat catalina.out normal situation to
Purpose Description
In executing the Linux command, we can redirect the output to the file, such as LS >a.txt, then we can't see the output, if we want to save the output to the file, but also want to see the output on the screen, we can use the
The difference between a single middle bracket and a double bracket in a shell
1.["[" is an executable program, the path is "/usr/bin/["He is equivalent to the executable program "test".
Example:If [3-eq 2]; Thenecho "= =";Elseecho "!=";Fi
Creating a table Create ' test1 ', ' lf ', ' SF ' Lf:column family of LONG values (binary value)--Sf:column family of STRING values imports According to put ' test1 ', ' user1|ts1 ', ' sf:c1 ', ' sku1 ' put ' test1 ', ' user1|ts2 ', ' sf:c1 ', '
How to implement the line content code to remove the file * * *:If you only want to see the first 5 lines of the file, you can use the Head command,such as: Head-5/etc/passwdIf you want to view the following 10 lines of the file, you can use the
In shell development, it's often used to date-related things, and here's how the Linux shell gets the date.
Get the current date: today= ' date +%y-%m-%d '
Get yesterday's date: yesterday= ' date-d '-1 day ' + '%y-%m-%d '
Get the date of N days
A lot of people are learning C + + language First, then learn shell script. If you have a little programming base, it's easy to understand the so-called order, selection, and loop. Order structure In fact, there is nothing to say, before the contact
a function
There is no obvious difference between a function and a shell script, but there is an essential difference in execution:
for a separate shell script, create a new shell process for it when executing, and interpret and execute the code in
Where the shell script needs to interact with the here document is the implementation, but some commands require the user to manually go on the interaction such as passwd, SCP
It is very painful to eliminate user interaction for automatic deployment,
1, disk use warning and send mail#!usr/bin/bash#df-th|grep '/$ ' This is the record that gets the memory used#后面两句是获取内存的使用率disk= ' df-th|grep '/$ ' |awk ' {print $ (NF-1)} ' |awk-f '% ' ' {print '} 'Mail_user=natashaIf [$disk-ge];thenecho "' Date
Function: Quickly and automatically generate keys and bulk push to remote host, suitable for batch push key for ansible environment#!/bin/bashkeypath=/root/.sshiplist=/root/ip.txt[[ -e ${iplist} ]] && > ${iplist}for i in `seq 81 91`do echo -E "192.
1, Special shell variable$# the number of arguments passed to the script$* displays all parameters passed to the script in a single string$$ the current process ID number for the script to run$! the ID number of the last process running in the
ObjectiveWe have successfully installed the Linux system--centos7, and now follow the super brother to the gate of Linux.So!Start a picture, equip all by dozen ...What the hell is this black one?Using Linux every day, is to open the virtual machine,
1, Shell 1.1, IntroductionThe shell is meant to mean "shell", a "shell" program that surrounds the Linux kernel, and all the tasks that the user completes on the operating system are implemented through the interaction of the shell with the Linux
I. Functions in the shellThe function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format:function f_name() { command}Note: The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service