cat misc.

cat xxx | more

cat xxx | less

cat > xxx , create a file xxx

cat -n xxx | more with line number information.

cat aaa.txt >> bbb.txt, the aaa.txt will be appened to bbb.txt

tail a file with auto update when file change

tail -f /var/log/syslog 

makefile with detail commands infomation 

make V = 1 , which will show the detailed commands 

To switch root user

sudo su switch to root user

using exit to go back to login user

To check which driver is mounting for CD-ROM

just typeing mount in terminate

/dev/sda2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot/efi type vfat (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=zjb)
/dev/sr0 on /media/zjb/UDF Volume type udf (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,umask=0077,uhelper=udisks2)

To create ISO from CD-ROM

dd if=source of=destination

example, dd if=/dev/sr0 of=windows.iso

To create ISO from folder

apt-get install genisoimage
genisoimage -o output_image.iso -J -R -l directory_name
-J -R -l is to keep the original filename

To install .deb file

sudo dpkg -i /path/to/deb/file

sudo apt install ./name.deb 

source bash_file

source is a Unix command that evaluates the file following the command, as a list of commands, executed in the current context

lz4c not found

apt-get install liblz4-tool

mkfs.ubifs not found

apt-get install mtd-utils

Installing the ncurses library which may used in make menuconfig

: Developer’s libraries for ncurses
: Developer’s libraries for ncursesw

tree list the folder/file in a tree way

tree -d directory only

tree -d -f  full file.

.bashrc

.bashrc文件主要保存个人的一些个性化设置,如命令别名、路径等。

.bash_profile'只在会话开始时被读取一次,而'.bashrc'则每次打开新的终端时,都要被读取。

要定义一个全局变量,使在以后打开的终端中生效,您需要将局部变量输出(export),可以用"export"命令:

export PATH=$PATH:/some/directory

get the inserted disk or sd card

sudo fdisk -l

or using 

lsblk

generate the patch file

e.g. diff -Nupr --no-dereference xyssl-0.8/ xyssl-0.8-dll/ >xyssl.patch

find a file

find . -name xxx.file

grep a word 

grep -rnw '/path/to/somewhere/' -e 'pattern'
  • -r or -R is recursive,
  • -n is line number, and
  • -w stands for match the whole word.
  • -l (lower-case L) can be added to just give the file name of matching files.

Along with these, --exclude, --include, --exclude-dir flags could be used for efficient searching:

  • This will only search through those files which have .c or .h extensions:

    grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
    
  • This will exclude searching all the files ending with .o extension:

    grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
    
  • For directories it's possible to exclude a particular directory(ies) through --exclude-dir parameter. For example, this will exclude the dirs dir1/, dir2/ and all of them matching *.dst/:

    grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
    

This works very well for me, to achieve almost the same purpose like yours.

For more options check man grep.

Linux 下计算代码行数的工具

cloc

http://cloc.sourceforge.net/

source and .

you can replace the first . as source, example . ./oe-init-build-env,  you can run as : source ./oe-init-build-env,

source is a shell built-in command which is used to read and execute the content of a file(generally set of commands), passed as an argument in the current shell script. It has a synonym in .

02-10 01:04
查看更多