Newly Blog


  • Home

  • Tags

  • Categories

  • Archives

  • Search

Bibliography Collection

Posted on 2022-06-16 | In paper note
  1. For the full name of journals and venue information of conferences, click Conference and Journal Info.

  2. For the collected full-length bib, click egbib collection.

Ubuntu Software Management

Posted on 2022-06-16 | In OS

raw: dpkg

1
2
3
4
5
6
dpkg -i xxx.deb
dpkg -r xxx.deb
dpkg --purge xxx.deb
dpkg -L xxx.deb
dpkg --info xxx.deb
dpkg -reconfigure xxx

dkpg is raw method to install without solving dependencies and existing software.

mature: apt-get

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
apt-get install softname1 softname2 softname3……
apt-get remove softname1 softname2 softname3……
apt-get remove --purge softname1
apt-get autoremove
apt-get clean //clean /var/cache/apt/archives
apt-get autoclean //clean the out-of-date files in /var/cache/apt/archives

apt-get update //update software information and database command
apt-get upgrade //update the system

apt-cache search rough_name
apt-cache show exact_name

pkg-config --libs opencv
pkg-config --cflags opencv
pkg-config --modversion opencv

apt-get is built on dkpg without saving the deb file. apt-get can solve dependencies and existing software. Note that when using dkpg, dkpg can circumvent apt-get, so apt-get don’t know the software installed by dkpg.

more mature: aptitude (GUI)

1
2
aptitude install softname1
aptitude remove softname1

aptitude is also built on dkpg and more powerful than apt-get.

Ubuntu Shell Scripts

Posted on 2022-06-16 | In OS

#!/bin/bash at the head of file indicates shell type

  1. strict format

    For if [[ $input == "hello" ]], note that the space after [[ and before ]] is very strict, since [[]] can be used for matching regular expression

  2. arguments

    • $@: stores all the arguments in a list of string
    • $*: stores all the arguments as a single string
    • $#: stores the number of arguments
    • shift: remove the first argument

When starting login or interative shells, certain files will be executed based on the following tables:

For bash:
login-y interactive-y: profile
login-y interactive-n: profile
login-n interactive-y: bashrc

For zsh:
login-y interactive-y: zshenv zprofile zshrc zlogin
login-y interactive-n: zshenv zprofile zlogin
login-n interactive-y: zshenv zshrc
login-n interactive-n: zshenv

Ubuntu Mount

Posted on 2022-06-16 | In OS

Mount remote folder on Windows/Linux:

1
2
sudo apt-get install cifs-utils
sudo mount -t cifs -o username=XXX,password=XXX //10.70.1.82/src_dir tgt_dir

Mount sharefolder between host machine and virtualbox:

1
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) share_name tgt_dir

Ubuntu Log-in Failure

Posted on 2022-06-16 | In OS

You may fail to log in Ubuntu due to the following reasons:

  1. /etc/environment or /etc/profile is modified to a wrong format: Just modify them back.

  2. startX is used improperly: run sudo rm -r .Xauthority*

Tips: use Ctr+Alt+F1~6 corresponding to tty 1~6 to use command line

Ubuntu language

Posted on 2022-06-16 | In OS
  1. $sudo gedit /etc/default/locale

  2. modify as follows,

    1
    2
    LANG="en_US.UTF-8"
    LANGUAGE="en_US:en"
  3. $locale-gen -en_US:en

  4. log out or reboot

Ubuntu Environment Variable

Posted on 2022-06-16 | In OS

For user-wide: ~/.profile or ~/.bashrc
For system-wide: /etc/profile

source ~/.bashrc or source /etc/profile can make the newly added (not the removed) environment variables for the current cmd window available immediately. However, you need to re-login to make them user-wide or system-wide.

Note that after you sudo su (not using sudo privilege), the environment variables will be lost. You need to re-login. Because sudo su will erase newly exported variables.

For permanent system-wide change even after sudo su, you should modify /etc/environment, which is not recommended. Because /etc/environment cannot recognize intermediate variable such as $JAVA_HOME. Sometimes misusing /etc/environment may result in your failure in login.

Not recommend running sudo su and then modifying ~/.profile or ~/.bashrc.

Ubuntu Crontab

Posted on 2022-06-16 | In OS
  • crontab -l //list crontab

  • crontab -r //remove crontab

  • crontab -e //edit crontab

    • minute hour day-of-month month day-of-week cmd
    • each term can be a single number, e.g., 3, or a range, e.g., 3-6, or a set, e.g., 3,5,7, or interval, e.g., */10
    • for example, “ /10 * sh ~/cmd.sh” means executing cmd.sh every 10 minutes.

In windows, the function of contrab can be realized by using “task scheduler”.

Ubuntu Command Lines

Posted on 2022-06-16 | In OS

Here is a website link to query linux commands.


  1. create new user with home folder

    1
    adduser XXX
  2. sudo privilege: vim /etc/sudoers and add $username ALL=(ALL) ALL at the bottom.

  3. start ssh on the server, the default port is 22

    1
    2
    sudo apt-get install openssh-server
    sudo/etc/init.d/ssh start
  4. list

    1
    2
    3
    list -a #including hidden files
    list -S #arrange by size
    list -t #arrange by time
  5. view text

    1
    2
    3
    cat
    head/tail -n 10 tmp.txt #view the first/last 10 lines
    less #more powerful than more
  6. Change the privilege

    1
    2
    chmod 777 ./
    chmod a+x ./
  7. Check disk or file size

    1
    2
    df -h 
    du ./ --max-depth 2 -h
  8. Compress or uncompress files, refer to this link.

  9. Grep + regular expression

    1
    grep [xyz]
  10. Search file

    1
    2
    3
    4
    5
    locate "keyword" #fast
    find ./ -maxdepth 1 -name "*keyword*"
    find ./ -name "*keyword*" -size +50M -size -100M
    find ./ -name "*keyword*" -mmin -10 #m:modify min:minute
    find ./ -name "*keyword*" -exec rm -r {} \;
  11. Pipe commands

    1
    2
    3
    ls -l | tr -s ' ' | cut -d ' ' -f 2 #tr to truncate space
    ls -l | sort -rnk2 #-r:reverse -n:numerical -k:k-th column
    ls -l | wc -l #count line
  12. xargs:

    1
    2
    3
    cat python/requirements.txt | xargs -L 1 sudo pip install
    find . -name "*.c" | xargs rm -rf
    find . -name '*.c' | xargs grep 'stdlib.h'
  13. alias: temporary alias command

    1
    2
    alias lnew="cd /home/niuli/caffe"
    unalias lnew
  14. export: The export command is one of the bash shell built-in commands, which means it is part of your shell.

    1
    2
    3
    4
    5
    6
    export a=linux.com
    echo $a
    export -n a #remove variable

    printname () { echo "Linuxcareer.com"; }
    export -f printname #export function

    add LD_LIBRARY_PATH

    1
    2
    echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/lib' >> ~/.bashrc
    source ~/.bashrc
  15. shellscript sample

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    #!/bin/bash
    read -p "Please input your first name: "
    echo -e "\nYour full name is: $firstname $lastname"
    test ! -e $filename && echo "The filename '$filename' DO NOT exist" && exit 0
    test -f $filename && filetype="regulare file"
    test -d $filename && filetype="directory"
    [ "$yn" == "Y" -o "$yn" == "y" ] && echo "OK, continue" && exit 0

    if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
    echo "OK, continue"
    elif [ "$yn" == "N" ] || [ "$yn" == "n" ]; then
    echo "Oh, interrupt!"
    else
    echo "I don't know what your choice is"
    fi

    while [ "$yn" != "yes" -a "$yn" != "YES" ]
    do
    read -p "Please input yes/YES to stop this program: " yn
    done

    for animal in dog cat elephant
    do
    echo "There are ${animal}s.... "
    done

Windows Command Lines

Posted on 2022-06-16 | In OS
  1. zip/unzip

    winrar x -y -ibck zip_file_name unzip_file_name //x means unzip, -y means yes to interrupted queries, -ibck means running in the background

  2. generate the file list under one folder

    dir D:\test /b >list.txt or dir D:\test /b >list.xls

  3. combine multiple compressed volumes

    copy /b logs.tar.gza* logs.tar.gz

1…8910…24
Li Niu

Li Niu

237 posts
18 categories
112 tags
Homepage GitHub Linkedin
© 2025 Li Niu
Powered by Hexo
|
Theme — NexT.Mist v5.1.4