原博地址:https://blog.csdn.net/weixin_42568655/article/details/94603660

(来自我的同学QiaoGuangtong大佬)

Fundamental About Linux

Partition.
    Generally, the partitions in linux, take the ubuntu for instance, four partitions are general, which including “/”, “/boot”, “/swap”, and “/home”, in which home is your users’ directory.

File Command

  In linux, the file processing commands are pretty important because all your actions are about file processing. So next term, let us to learn about the commands for processing the files.
At first, you should know that the command is case sensitive, for which you should know which are upper case, and which are lowercase.

 ls -list directory contents

List the files and directory from current directory order by the first case default.

  Options     Long Option     Describe
  -a   -all   List all files
  -l   -long   Display results in long format
  -t   -time   Display result order by time

cp -copy

 This command can copy files or directories. It can be used two different ways.
    cp item1 item2
    to copy the file or directory from item1 to item2, and
    cp item… directory
    to copy multiple items (files or directories) into a directory.
    Example:
    cp -r item1 item2
    Recursively copy directories and their contents. This option is required when item1 is a directory.

mv -move
    This command can move file or directory to a new directory and rename a file
    Example:
    mv item1… item2
    Like cp, move files or recursively move directories and their contents. item1 and item2 can be directory or file.

rm -remove
    This command can remove the directed file or directory
    Example:
    rm -r item
    The same, recursively remove directories and their contents. This option is required when item is a directory.
    rm -f item
    This command will cancel warning when you remove a file or directory and its contents.
    rm -rf item
    This command combined two above.

tar
    This command can zip or unzip the directed files or directories.
    Example:
    tar -czvf item1 item2….
    -czvf create zip visual file (new file name)
    This command can zip item2, which can be file or directory. item2 can be multiple items.
    tar -xvzf item
    This command can unzip item, a zip file.

chmod -change mode
    This command can change permissions of a file or directory.
    Example:
    chmod u+x item    add execute on item for current user
    chmod u+r item    add read on item for current user
    chmod u+x item add write on item for current user
    chmod g+x item    g is group add execute for all users in the same group with current user.
    chmod a+x item    a is all add execute for all users

touch
    This command can change the time for visiting and changing. If the file does not exists, create a new file.
    option:
    touch [filename]
    This command can create a new file filename.

find
    This command is the most complex in my class that cannot remind me all the time.
    find ./ -size -name passwd -ok cp {} /home ;

Directory Command

mkdir
    This command can create a new directory
    Example:
    mkdir item
    This command creates a directory item in current directory.
    cd
    This command can change directory
    Example:
    cd item
    This command changes into item, which is a directory.

User Command

su
    This command can change current user to another.
    Example:
    su sam
    This command change user to sam.
    passwd
    This command can update password for a user.
    Example:
    passwd sam
    This command can update password for sam.

Other Command

cat
    This command can display the content of a file. E.g. cat a.txt
    echo
    This command can display the content of a string or environment variables and so on. E.g. echo java
    ps -ef
    This command can display the processes of current system.
    kill -9 [pid]
    This command can kill a process which number is pid.

Vi/Vim

vi is a screen-oriented text editor originally created for the Unix operating system.
vi is a modal editor: it operates in either insert mode (where typed text becomes part of the document) or command mode (where keystrokes are interpreted as commands that control the edit session). When you enter “:” , you will enter last-line mode.

change mode:
i from command mode to insert command
Command mode:
dd    delete current line
yy    copy current line to buffer
nyy copy n lines to buffer

Last-line mode:
:q quit with no action
:wq save write and quit
:q! force to quit
:x save and quit

. Shell Scripting

  1. Tips     For a new shell scripting, you can make it according the following steps.
  2. Write your shell scripting file using vi/vim or other editors
  3. Change its permissions so that it can be executed
  4. Execute it
  5. Practice

copy files

  copy /etc/passwd, /etc/profile, /etc/shadow to current directory.

 cp /etc/passwd ./
cp /etc/profile ./
cp /etc/shadow ./

Specific size

  Decide if a number is greater than 50.

 x=
if [ $x -gt ] ; then
echo ">0"
else
echo "<=0"
fi ./e1

Add 1-100

  Display the sum from 1 to 100

 i=;
sum=;
while [ $i -lt ] ; do
let i+=
let sum+=$i
done
echo "sum is $sum"

Create Files

  Please create 100 files f1 to f100

 i=;
while [ $i -lt ] ; do
i+=
touch f$i
done

Re-Write cp

  Re-Write my copy using two arguments, and decide if the first argument is a directory

 if [ -f $ ] ; then
cp $ $
else
cp -r $ $
fi

Ten Score cp

(快考试了排不完了 先不排了)

(有空再弄)

(烂尾预警)

【转载】Linux Examination的更多相关文章

  1. [转载]Linux进程调度原理

    [转载]Linux进程调度原理 Linux进程调度原理 Linux进程调度的目标 1.高效性:高效意味着在相同的时间下要完成更多的任务.调度程序会被频繁的执行,所以调度程序要尽可能的高效: 2.加强交 ...

  2. [转载]Linux下非root用户如何安装软件

    [转载]Linux下非root用户如何安装软件 来源:https://tlanyan.me/work-with-linux-without-root-permission/ 这是本人遇到的实际问题,之 ...

  3. [转载]Linux 命令详解:./configure、make、make install 命令

    [转载]Linux 命令详解:./configure.make.make install 命令 来源:https://www.cnblogs.com/tinywan/p/7230039.html 这些 ...

  4. [转载]Linux缓存机制

    [转载]Linux缓存机制 来源:https://blog.csdn.net/weixin_38278334/article/details/96478405 linux下的缓存机制及清理buffer ...

  5. [转载] Linux启动过程详解-《别怕Linux编程》之八

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket.为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. = ...

  6. [转载]Linux命令笔记

    *以下内容均来自于网络转载,感谢原作者分享 <对Linux新手非常有用的20个命令> 传送门 英文原文为“Switching From Windows to Nix or a Newbie ...

  7. 转载 linux内核 asmlinkage宏

    转载http://blog.chinaunix.net/uid-7390305-id-2057287.html 看一下/usr/include/asm/linkage.h里面的定义:#define a ...

  8. [转载] Linux下高并发socket最大连接数所受的各种限制

    原文: http://mp.weixin.qq.com/s?__biz=MzAwNjMxNjQzNA==&mid=207772333&idx=1&sn=cfc8aadb422f ...

  9. [转载]linux下svn常用指令

    一下内容转载于:http://blog.chinaunix.net/space.php?uid=22976768&do=blog&id=1640924.这个总结的很好~ windows ...

随机推荐

  1. low版九九乘法表

    # while循环实现九九乘法表num_one = 1while num_one <= 9: num_two = 1 while num_two <= num_one: print(&qu ...

  2. 【CF888G】Xor-MST

    题目 也不是很知道为什么这道题要和某\(B\)姓算法扯上关系 首先有一个非常显然基于那个\(B\)姓算法的做法,每次启发式合并\(trie\)即可,复杂度是\(O(n\ logn\ loga_i)\) ...

  3. Android开发 EditText按回车按键后出现 focus search returned a view that wasn't able to take focus! 错误

    问题描述 将EditText这个View成为了ListView或者RecyclerView的item时,在按输入法的回车/下一步/next时会出现的 focus search returned a v ...

  4. xcart小数点位数

    xcart小数点的位数默认是2位,有时候需要根据需要更改位数:一开始以为把数据库中的数据类型的位数更改过后,就能生效,结果发现xcart在程序中作了限制,只能是2位.那么只能通过更改程序的方式来更改了 ...

  5. git归纳总结

    1,git 是分布式版本控制:单个电脑就是一个完整的版本库,只需向中央服务器(远程服务器)提交修改的部分.在没有网络情况下也能正常想本机服务器提交代码管理版本,有网时再推送到远程服务器.   svn是 ...

  6. Docker系列(十):Kubernetes集群入门

    kubenetes安装 官网:https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/getting-started- guide ...

  7. Python学习day03 - Python基础(1)

    1. 执行Python程序的两种方式 (1)交互式(Jupyter) 优点:运行一句执行一句 缺点:关闭即消失# (2)命令行式(pycharm) 优点:可以一直保存 缺点:全部写完才能调试bug虽然 ...

  8. INI文件读写类

    public class INIClass { public string inipath; [DllImport("kernel32")] private static exte ...

  9. springcloud(四):Eureka的配置详解

    在Eureka的服务治理体系中,主要分为服务端和客户端两个不同的角色,服务端为服务注册中心,客户端为提供各个接口的微服务应用,这里介绍一下Eureka的配置. Eureka服务端配置 在实际应用中,我 ...

  10. C++给组合框控件(Combo box)加变量后不能运行

    是一个BUG,找出你程序存储的位置,打开一个Debug的文件夹,将除.res文件之外的所有文件删除,然后运行,就可以了!!