본문 바로가기

ComputerScience/Linux

Linux2. linux commands and tools

728x90
chmod 755 test.sh
nohup python3 app.py

scp user@ip:remote_dir user2@ip2:remote_dir
scp user@ip:remote_dir local_path

df -h
df -lh

curl -X localhost:5000/{data}

ps

history | grep "echo"
ls | grep "vi" > output.txt

echo "hi" > test.txt
echo "hello" >> test.txt

cat cut_file | cut -d : -f 1,7
cat fruits.txt | sort | uniq | wc -l 

grep "^a" grepfile
grep -i "^a" grepfile
grep -i "e$" grepfile

head -n 3 test.txt
tail -n 3 test.txt

tree -L 2

1. Shell or Terminal

a shell is a program that receives commands from the user and gives it to the linux kernel, and it shows the output

 

2. command - apt

The apt is a command which works with Ubuntu's Advanced Packaging Tool (APT)

It performs installation of new software packages,

upgrade of existing software packages,

updating of the package list index, and even upgrading the entire Ubuntu system.

 

3. command - tar

tar -cvf foo.tar : when compressing

tar -xvf foo.tar : when extracting

 

4. command - tmux

It allows multiple terminal sessions to be accessed simultaneously in a single window

ctrl + b + d : detach (session maintained even though you close your mac)

 

5. command - ctags

if you want to look up definition of a function (or a specific file), you can go to the definition by using ctags.

We can find or move to where certain functions and variables are declare or defined

ctag generates an index (or tag) file of names found in source and header files.

tags file is a kind of database which has the information of where the specific function is located.

// create tags file from current position to every lower directory
ctags -R

// if you want to find vfs_read
vi tags
:tj vfs_read

// instead of writing tj everytime
// put cursur at the function 
crtl + ]

// 이전 화면으로 이동
ctrl + t

 

6. command - cscope

cscope is similiar with ctags. it is used on very large projects to find source code, functions, declarations, definitions and regular expressions

// generate cscope.out
sudo sh -c 'find ./ -name '*.[cCsShH]' > file_list'
cscope -i file_list

// how to search
vi cscope.out
:cscope add cscope.out
:cs find [search type] keyword
728x90
반응형

'ComputerScience > Linux' 카테고리의 다른 글

Linux8. Process  (1) 2023.10.09
Linux6. Makefile  (0) 2023.09.28
Linux4. Design Principle of Linux Kernel  (0) 2023.09.28
Linux3. System Call  (1) 2023.09.28
Linux1. Operating System? Linux?  (0) 2023.09.14