1.预处理,生成预编译文件(.文件): Gcc –E hello.c –o hello.i 2.编译,生成汇编代码(.s文件): Gcc –S hello.i –o hello.s 3.汇编,生成目标文件(.o文件): Gcc –c hello.s –o hello.o 4.链接,生成可执行文件: linux笔记

1 动态查看日志 tail -f filename

                     tail -1000f filename

2 解压当前目录内容为xxx.zip  zip -r xxx.zip ./*

3 查看内存使用情况 free -m

4 vim批量替换字符串:%s/source_str/target_str/g

                     使用场景,个人博客网站移植新服务器过程中,用户文章文件之前保存的图片地址带有原服务器ip,需要批量替换为新服务器ip,用这个方法很合适。

5 Linux shell中获取日期:DATE=$(date +%Y%m%d)

6 定时执行脚本 crontab -e    

                 0 3 * * * /root/.shell/back_up.sh  凌晨3:00执行

7 判断是否存在某路径、文件夹:test -d PATH && echo 'exit'

                    test -f PATH && echo 'exit'

8 Linux下端口占用问题解决

     (1).查找被占用的端口

            netstat -tln  

            netstat -tln | grep 8083  

            netstat -tln 查看端口使用情况,而netstat -tln | grep 8083 则是只查看端口8083的使用情况

     (2).查看端口属于哪个程序?端口被哪个进程占用

            lsof -i :8083  

     (3)杀掉占用端口的进程

             kill -9 进程id   

       转自:http://taoistwar.iteye.com/blog/701704
9 gcc C语言编译:

       (1).预处理,生成预编译文件(.文件):

        Gcc –E hello.c –o hello.i
       (2).编译,生成汇编代码(.s文件):

        Gcc –S hello.i –o hello.s
       (3).汇编,生成目标文件(.o文件):
        Gcc –c hello.s –o hello.o
       (4).链接,生成可执行文件:
        Gcc hello.o –o hello

10 目标文件反汇编objdump -S obj

原文地址:https://www.cnblogs.com/rixiang/p/6219065.html