zoukankan      html  css  js  c++  java
  • useful command

    pw 1aA?
    nohup command >/dev/null 2>&1   # doesn't create nohup.out
    nohup ./a.out &
    tail -f nohup.out
      -f, --follow[={name|descriptor}]
      output appended data as the file grows;
      an absent option argument means 'descriptor'
    https://guides.github.com/
    https://github.com/git-lfs/git-lfs/issues/911 Smudge filter failed with a fresh new clone
    https://blog.csdn.net/weixin_34161029/article/details/86978708 ubuntu 设置开机自启动 / 设置定时重启 / crontab 定时执行 / 后台执行
    https://www.cnblogs.com/darklights/p/7722861.html  Ubuntu 16.04安装Fcitx拼音输入法  fcitx-diagnose
    https://blog.csdn.net/dlmu2001/article/details/8842891 strace
    https://blog.csdn.net/chenbetter1996/article/details/85166528 vscode
    sudo apt-get purge nvidia-*
    g++ opmp.cc -fopenmp --verbose > ff 2>&1
    sudo apt-get autoremove --purge
    sudo add-apt-repository ppa:graphics-drivers
    sudo apt-get update
    sudo apt-get install nvidia-410

      查看软件版本:     aptitude show xxx

      patch -p0 < geometry2_0.5.16_tf2.patch

    http://www.brixbot.com/category/ros2/

      docker images|grep none|awk '{print $3 }'|xargs docker rmi

    swap: 

    837 dd if=/dev/zero of=/swap1 bs=1M count=2048
    838 sudo dd if=/dev/zero of=/swap1 bs=1M count=16384
    839 swapoff /swap1
    840 sudo swapoff /swap1
    841 sudo dd if=/dev/zero of=/swap1 bs=1M count=16384
    842 mkswap /swap1
    843 sudo mkswap /swap1
    844 swapon /swap1
    845 sudo swapon /swap1

    sudo swapoff /swap1

    Q:

    root@ubuntu:/home/pipi# find / -perm -2000

    /sbin/unix_chkpwd
    find: `/home/pipi/.gvfs': 权限不够

    A:

    #umount /home/useraccount/.gvfs
    #find . -inum 554009 -exec rm{} ;
    After that,
    #rm -rf .gvfs

    Q:

    通过终端安装程序sudo apt-get install xxx时出错:
    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it

    A:

    出现这个问题可能是有另外一个程序正在运行,导致资源被锁不可用。而导致资源被锁的原因可能是上次运行安装或更新时没有正常完成,进而出现此状况,解决的办法其实很简单:

    在终端中敲入以下两句
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/dpkg/lock 

    # 在源代码根目录,使用git status命令获取已修改文件的列表
    git status | grep modified | awk '{print $2}' > list.txt
    # 在当前目录下,创建temp目录
    mkdir temp
    # 将已修改文件列表逐一复制到当前目录下的temp目录
    xargs -a ./list.txt cp --parents -t ./temp

    # 将temp目录下的所有文件打包为modules.tar.gz
    cd temp
    tar -czf modules.tar.gz *
    https://www.runoob.com/nodejs/nodejs-http-server.html

    tinyxml2 https://blog.csdn.net/zhawk/article/details/60880036
    https://csuyangpeng.slack.com/messages/CG9KY8199/
    https://www.cnblogs.com/51kata/category/789766.html
    http://dockone.io/article/128

    在Ubuntu下,时不时会有这个错误的。 add-apt-repository: command not found

    $ sudo apt-get install software-properties-common python-software-properties

    ps -aux |grep distccd |grep -v grep|awk '{print $2}' |xargs kill -9
    13316476216
    075506010053@163.gd
    https://stackoverflow.com/questions/7832770/how-to-get-certain-commit-from-github-project
    scp yangpeng@10.9.139.171:/MOM/codeBuild02/yangpeng/45G/upSystem_v2.1_sz .

     yangpeng@10.9.139.171's password:
     upSystem_v2.1_sz: not a regular file
     [root@localhost yp]# scp -r yangpeng@10.9.139.171:/MOM/codeBuild02/yangpeng/45G/upSystem_v2.1_sz .

     grep -rn "xxx" *

    1、可以使用grep命令来查找当前目录下所有文件中包含的某个特定字符。

    2、示例:查找当前目录下所有带有set的文件 。

    说明:

    -r 是递归查找

    -n 是显示行号

    * : 表示当前目录所有文件,也可以是某个文件名

    find . -name  "*.cc"

    find ./ -name "*.java" -o -name "*.xml"

     Google C++ Style Guide

    https://google.github.io/styleguide/cppguide.html#Constant_Names

    https://github.com/ApolloAuto/apollo/tree/apollo  csuyangpeng0308

    http://wiki.ros.org/rosbag/Code%20API#cpp_api

     1 moonx@moonx:/usr/download/boost_1_42_0/pro$ cat test_header.cpp 
     2 #include<nonexist.h> // This is a non-existant system header
     3  
     4 int main ( int argc, char* argv[] )
     5 {
     6     return 0;
     7 }
     8 moonx@moonx:/usr/download/boost_1_42_0/pro$ g++ -c -v test_header.cpp 
     9 Using built-in specs.
    10 COLLECT_GCC=g++
    11 Target: x86_64-linux-gnu
    12 Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    13 Thread model: posix
    14 gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 
    15 COLLECT_GCC_OPTIONS='-c' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
    16  /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE test_header.cpp -quiet -dumpbase test_header.cpp -mtune=generic -march=x86-64 -auxbase test_header -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccmXkUCU.s
    17 GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) version 5.4.0 20160609 (x86_64-linux-gnu)
    18     compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
    19 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    20 ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
    21 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
    22 ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
    23 #include "..." search starts here:
    24 #include <...> search starts here:
    25  /usr/download/boost_1_42_0
    26  .
    27  /usr/include/c++/5
    28  /usr/include/x86_64-linux-gnu/c++/5
    29  /usr/include/c++/5/backward
    30  /usr/lib/gcc/x86_64-linux-gnu/5/include
    31  /usr/local/include
    32  /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
    33  /usr/include/x86_64-linux-gnu
    34  /usr/include
    35 End of search list.
    36 GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) version 5.4.0 20160609 (x86_64-linux-gnu)
    37     compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
    38 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    39 Compiler executable checksum: 8c2b43f572cd3f060e41aeab70254763
    40 test_header.cpp:1:61: fatal error: nonexist.h: 没有那个文件或目录
    41 compilation terminated.
    42 moonx@moonx:/usr/download/boost_1_42_0/pro$ 
    gcc -c -v **.cpp 显示查找头文件的过程
    1 编译链接:动态库 静态库 
    gcc编译线程程序,为什么要加-lpthread,头文件已经包含了<pthread.h>了啊 2 3 编译程序包括 预编译, 编译,汇编,链接 4 包含头文件了,仅能说明有了线程函数的声明, 但是还没有实现, 加上-lpthread是在链接阶段,链接这个库 5 6 谢谢。那其它的呢?很多比如<stdio.h> <sys/ipc.h> <sys/sem.h> <sys/shm.h>。还有很多,都不要加,难道就<pthread.h>比较特别??? 7 8 其他的可能包含在默认链接的库中,如libc, 其他不清楚,很少写linux代码,忘的差不多了 9 10 &lt;stdio.h&gt;等都是静态库,不需要做额外的表示,连接时会直接链接进代码里。pthread是动态库,需要用-lpthread,所有的动态库都需要用-lxxx来引用
    1. 本地分支重命名
    git branch -m oldbranchname newbranchname

    支持C++11特性:gcc -g -Wall -std=c11 main.cpp

    创建tar.xz文件:只要先 tar cvf xxx.tar xxx/ 这样创建xxx.tar文件先,然后使用 xz -z xxx.tar 来将 xxx.tar压缩成为 xxx.tar.xz

    解压tar.xz文件:先 xz -d xxx.tar.xz 将 xxx.tar.xz解压成 xxx.tar 然后,再用 tar xvf xxx.tar来解包。

    https://bigsearcher.com/mirrors/gcc/releases/gcc-8.2.0/

    gcc-8.1.0安装

    tar -Jxvf gcc-8.1.0.tar.xz

    cd gcc-8.1.0 ./contrib/download_prerequisites

    cd .. mkdir temp_gcc81 && cd temp_gcc81

    ../gcc-8.1.0/configure --prefix=/usr/local/gcc-8.1 --enable-threads=posix --disable-checking --disable-multilib

    #error "Unable to find a suitable type for HOST_WIDE_INT"

    unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE

    make

    sudo make install 


    adding-public-key-to-ssh-authorized-keys-does-not-log-me-in-automatically

    https://stackoverflow.com/questions/6377009/adding-public-key-to-ssh-authorized-keys-does-not-log-me-in-automatically

    You need to verify the permissions of the authorized_keys file and the folder / parent folders in which it is located.

    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
    

    For more information see this page.

    You may also need to change/verify the permissions of your home directory to remove write access for the group and others.

    chmod go-w ~ 
     1 moonx@MoonXComputer:~/.ssh$ ssh -v moonx@192.168.4.74
     2 OpenSSH_7.2p2 Ubuntu-4ubuntu2.7, OpenSSL 1.0.2g  1 Mar 2016
     3 debug1: Reading configuration data /etc/ssh/ssh_config
     4 debug1: /etc/ssh/ssh_config line 19: Applying options for *
     5 debug1: Connecting to 192.168.4.74 [192.168.4.74] port 22.
     6 debug1: Connection established.
     7 debug1: identity file /home/moonx/.ssh/id_rsa type 1
     8 debug1: key_load_public: No such file or directory
     9 debug1: identity file /home/moonx/.ssh/id_rsa-cert type -1
    10 debug1: key_load_public: No such file or directory
    11 debug1: identity file /home/moonx/.ssh/id_dsa type -1
    12 debug1: key_load_public: No such file or directory
    13 debug1: identity file /home/moonx/.ssh/id_dsa-cert type -1
    14 debug1: key_load_public: No such file or directory
    15 debug1: identity file /home/moonx/.ssh/id_ecdsa type -1
    16 debug1: key_load_public: No such file or directory
    17 debug1: identity file /home/moonx/.ssh/id_ecdsa-cert type -1
    18 debug1: key_load_public: No such file or directory
    19 debug1: identity file /home/moonx/.ssh/id_ed25519 type -1
    20 debug1: key_load_public: No such file or directory
    21 debug1: identity file /home/moonx/.ssh/id_ed25519-cert type -1
    22 debug1: Enabling compatibility mode for protocol 2.0
    23 debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
    24 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
    25 debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.7 pat OpenSSH* compat 0x04000000
    26 debug1: Authenticating to 192.168.4.74:22 as 'moonx'
    27 debug1: SSH2_MSG_KEXINIT sent
    28 debug1: SSH2_MSG_KEXINIT received
    29 debug1: kex: algorithm: curve25519-sha256@libssh.org
    30 debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    31 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    32 debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    33 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    34 debug1: Server host key: ecdsa-sha2-nistp256 SHA256:scmIqSf23TCO6MoFBWwq7bswmg+luMjjb14FkAm157o
    35 debug1: Host '192.168.4.74' is known and matches the ECDSA host key.
    36 debug1: Found key in /home/moonx/.ssh/known_hosts:1
    37 debug1: rekey after 134217728 blocks
    38 debug1: SSH2_MSG_NEWKEYS sent
    39 debug1: expecting SSH2_MSG_NEWKEYS
    40 debug1: SSH2_MSG_NEWKEYS received
    41 debug1: rekey after 134217728 blocks
    42 debug1: SSH2_MSG_EXT_INFO received
    43 debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
    44 debug1: SSH2_MSG_SERVICE_ACCEPT received
    45 debug1: Authentications that can continue: publickey,password
    46 debug1: Next authentication method: publickey
    47 debug1: Offering RSA public key: /home/moonx/.ssh/id_rsa
    48 debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
    49 debug1: Authentication succeeded (publickey).
    50 Authenticated to 192.168.4.74 ([192.168.4.74]:22).
    51 debug1: channel 0: new [client-session]
    52 debug1: Requesting no-more-sessions@openssh.com
    53 debug1: Entering interactive session.
    54 debug1: pledge: network
    55 debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
    56 debug1: Sending environment.
    57 debug1: Sending env LC_PAPER = zh_CN.UTF-8
    58 debug1: Sending env LC_ADDRESS = zh_CN.UTF-8
    59 debug1: Sending env LC_MONETARY = zh_CN.UTF-8
    60 debug1: Sending env LC_NUMERIC = zh_CN.UTF-8
    61 debug1: Sending env LC_TELEPHONE = zh_CN.UTF-8
    62 debug1: Sending env LC_IDENTIFICATION = zh_CN.UTF-8
    63 debug1: Sending env LANG = en_US.UTF-8
    64 debug1: Sending env LC_MEASUREMENT = zh_CN.UTF-8
    65 debug1: Sending env LC_TIME = zh_CN.UTF-8
    66 debug1: Sending env LC_NAME = zh_CN.UTF-8
    67 Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.15.0-45-generic x86_64)
    68 
    69  * Documentation:  https://help.ubuntu.com
    70  * Management:     https://landscape.canonical.com
    71  * Support:        https://ubuntu.com/advantage
    72 
    73 8 packages can be updated.
    74 0 updates are security updates.
    75 
    76 New release '18.04.1 LTS' available.
    77 Run 'do-release-upgrade' to upgrade to it.
    78 
    79 Last login: Fri Feb 15 17:42:00 2019 from 127.0.0.1
    80 
    81 
    82 gssapi-keyex,gssapi-with-mic,
    View Code

     linux服务器查看公网IP信息的方法

    最近在解决网络问题时,需要查看本机的出口公网IP信息,所以在网络上搜索和请求运维达人,获得如下两个方法:curl ifconfig.me

    在linux系统中输入上述的命令,可以查看到本机连接的公网信息;如果该命令无效,可以使用下面一个命令,也同样可以获得对应的信息 curl cip.cc https://blog.csdn.net/gebitan505/article/details/14448429 

  • 相关阅读:
    Django(app的概念、ORM介绍及编码错误问题)
    Django(完整的登录示例、render字符串替换和redirect跳转)
    Construct Binary Tree from Preorder and Inorder Traversal
    Single Number II
    Single Number
    Binary Tree Level Order Traversal II
    Binary Tree Level Order Traversal
    Binary Tree Zigzag Level Order Traversal
    Recover Binary Search Tree
    Add Binary
  • 原文地址:https://www.cnblogs.com/cjyp/p/10150608.html
Copyright © 2011-2022 走看看