树莓派Raspberry实践笔记-常用Linux命令

FILESYSTEM

LS

CD

PWD

MKDIR

RMDIR

To remove empty directories, use rmdir. So, for example, rmdir oldDir will remove the directory oldDir only if it is empty.

RM

The command rmremoves the specified file (or recursively from a directory when used with -r). Be careful with this command: files deleted in this way are mostly gone for good!

CP

Using cp makes a copy of a file and places it at the specified location (this is similar to copying and pasting). For example, cp ~/fileA /home/otherUser/would copy the file fileA from your home directory to that of the userotherUser (assuming you have permission to copy it there). This command can either take FILE FILE (cp fileA fileB), FILE DIR(cp fileA /directoryB/) or -r DIR DIR (which recursively copies the contents of directories) as arguments.

MV

The mv command moves a file and places it at the specified location (so wherecp performs a ‘copy-paste‘, mv performs a ‘cut-paste‘). The usage is similar tocp. So mv ~/fileA /home/otherUser/ would move the file fileA from your home directory to that of the user otherUser. This command can either takeFILE FILE (mv fileA fileB), FILE DIR (mv fileA /directoryB/) orDIR DIR (mv /directoryB /directoryC) as arguments. This command is also useful as a method to rename files and directories after they‘ve been created.

TOUCH

The command touch sets the last modified time-stamp of the specified file(s) or creates it if it does not already exist.

CAT

You can use cat to list the contents of file(s), e.g. cat thisFile will display the contents of thisFile. Can be used to list the contents of multiple files, i.e.cat *.txt will list the contents of all .txt files in the current directory.

HEAD

The head command displays the beginning of a file. Can be used with -n to specify the number of lines to show (by default ten), or with -c to specify the number of bytes.

TAIL

The opposite of headtail displays the end of a file. The starting point in the file can be specified either through -b for 512 byte blocks, -c for bytes, or-n for number of lines.

CHMOD

You would normally use chmod to change the permissions for a file. The chmodcommand can use symbols u (user that owns the file), g (the files group) , ando (other users) and the permissions r (read), w (write), and x (execute). Using chmod u+x *filename* will add execute permission for the owner of the file.

CHOWN

The chown command changes the user and/or group that owns a file. It normally needs to be run as root using sudo e.g. sudo chown pi:root *filename* will change the owner to pi and the group to root.

SSH

ssh denotes the secure shell. Connect to another computer using an encrypted network connection. For more details see SSH (secure shell)

SCP

The scp command copies a file from one computer to another using ssh. For more details see SCP (secure copy)

SUDO

The sudo command enables you to run a command as a superuser, or another user. Use sudo -s for a superuser shell. For more details see Root user / sudo

DD

The dd command copies a file converting the file as specified. It is often used to copy an entire disk to a single file or back again. So, for example,dd if=/dev/sdd of=backup.img will create a backup image from an SD card or USB disk drive at /dev/sdd. Make sure to use the correct drive when copying an image to the SD card as it can overwrite the entire disk.

DF

Use df to display the disk space available and used on the mounted filesystems. Use df -h to see the output in a human-readable format using M for MBs rather than showing number of bytes.

UNZIP

The unzip command extracts the files from a compressed zip file.

TAR

Use tar to store or extract files from a tape archive file. It can also reduce the space required by compressing the file similar to a zip file.

To create a compressed file, use tar -cvzf *filename.tar.gz* *directory/*To extract the contents of a file, use tar -xvzf *filename.tar.gz*

PIPES

A pipe allows the output from one command to be used as the input for another command. The pipe symbol is a vertical line |. For example, to only show the first ten entries of the ls command it can be piped through the head commandls | head

TREE

Use the tree command to show a directory and all subdirectories and files indented as a tree structure.

&

Run a command in the background with &, freeing up the shell for future commands.

WGET

Download a file from the web directly to the computer with wget. Sowget https://www.raspberrypi.org/documentation/linux/usage/commands.mdwill download this file to your computer as commands.md

CURL

Use curl to download or upload a file to/from a server. By default, it will output the file contents of the file to the screen.

MAN

Show the manual page for a file with man. To find out more, run man man to view the manual page of the man command.

SEARCH

GREP

Use grep to search inside files for certain search patterns. For example,grep "search" *.txt will look in all the files in the current directory ending with .txt for the string search.

The grep command supports regular expressions which allows special letter combinations to be included in the search.

AWK

awk is a programming language useful for searching and manipulating text files.

FIND

The find command searches a directory and subdirectories for files matching certain patterns.

WHEREIS

Use whereis to find the location of a command. It looks through standard program locations until it finds the requested command.

NETWORKING

PING

The ping utility is usually used to check if communication can be made with another host. It can be used with default settings by just specifying a hostname (e.g. ping raspberrypi.org) or an IP address (e.g. ping 8.8.8.8). It can specify the number of packets to send with the -c flag.

NMAP

nmap is a network exploration and scanning tool. It can return port and OS information about a host or a range of hosts. Running just nmap will display the options available as well as example usage.

HOSTNAME

The hostname command displays the current hostname of the system. A privileged (super) user can set the hostname to a new one by supplying it as an argument (e.g. hostname new-host).

IFCONFIG

Use ifconfig to display the network configuration details for the interfaces on the current system when run without any arguments (i.e. ifconfig). By supplying the command with the name of an interface (e.g. eth0 or lo) you can then alter the configuration: check the manual page for more details.

时间: 2024-07-30 04:29:52

树莓派Raspberry实践笔记-常用Linux命令的相关文章

树莓派Raspberry实践笔记-另类方法安装minicom

[原创链接]:http://www.cnblogs.com/atsats/p/6665566.html 通常使用命令安装软件apt-get install , 如:sudo apt-get install minicom 本文是结合最新的Raspbain jessie,使用图形化的方式安装一款软件:串口调试工具minicom. 基本方法:使用系统自带的 "Add /Remove Software"软件. 1. 打开 "Add /Remove Software" 2.

树莓派Raspberry实践笔记-解决官方文档打开慢问题

官方网站打开时,经常很慢,看点资料无法忍受.今天发现器文档在github上也有,通过github就快很多了! 官方:https://www.raspberrypi.org/documentation/ Raspberry github:https://github.com/raspberrypi/documentation   #这个快很多 提醒:使用github可以一次性下载所有文档.文档格式为markdown(.md的文件),可用专用的MarkDown软件浏览.

常用Linux命令笔记

任何脱离业务的架构都是耍流氓 只记录实际常用的Linux命令 常用Linux命令 查找安装路径: whereis nginx 查询nginx进程: ps aux|grep nginx 查看 CentOS 内核版本: # 查看内核版本 uname -r 卸载 Docker: # 查看 yum list installed | grep docker # 卸载 yum -y remove docker.xxx.x86_64 # 删除 rm -ef /var/lib/docker #查看ip信息 ip

大数据基础之常用Linux命令

大数据实验环境一般为Linux,熟悉Linux操作非常有必要,总结常用Linux命令如下. 1.cd命令 进入文件夹: cd dirname 进入多级文件夹: cd /usr/local/Cellar 返回上层目录: cd ../ 返回上层的上层: cd ../../ 回到主文件夹 cd 2.ls命令 ls命令用于列出当前文件和目录,加上参数之后可以做更多的事情. 不带参数运行ls会列出文件和目录 ls 使用-l参数切换到长清单模式,会显示当前目录内容的长列表: ls -l 加上-lh参数显示文

网络服务器搭建、配置与管理(2)常用linux命令

常用linux命令 用root用户登录,用passwd命令修改root用户密码,并修改一个普通用户密码.用一个普通用户登录,用passwd命令修改用户密码.("#"是超级用户的系统提示符:"$"是普通用户的系统提示符) 通过help显示所有可以通过help提供信息显示的命令列表,并且分页显示.(若想中途退出帮助文档,则按"Q"键) 通过man命令显示ls命令的帮助.(显示指定命令的手册页帮助信息,man显示信息多余一页时会自动分页,用户可以通过空

77个常用Linux命令和工具

77个常用Linux命令和工具 Linux管理员不能单靠GUI图形界面吃饭.这就是我们编辑这篇最实用Linux命令手册的原因.这个指南是特别为Linux管理员和系统管理员 设计的,汇集了最有用的一些工具做为他们日常维护的参考手册.通过学习这些简单的工具,那些原本害怕命令行的人也可以变成一个脚本高手,从而通过执行 kernal命令和shell命令来最大限度的发挥linux的作用.请善用我们的指南,有任何Linux方面的问 题或者需要寻找相关答案请务必到我们 的TechTarget中国服务器论坛来发

[转载]开发人员需要熟知的常用Linux命令之二:Crontab

上面说了那么多的常用命令,还有一个功能我们也经常用到,就是定时器.日程表,一般通过crontab来运行:crontab 指定在固定时间或固定间隔执行特定的脚本:crontab的常用参数有如下3个: -e :执行文字编辑器来设定日程表,一般默认的编辑器是VI: -r :删除目前所有的日程表: -l :列出目前所有的日程表: 设置日程表时,需要有固定的格式,共6部分,各部分间用空格间隔:其中第6个部分是要执行的命令,前5个部分是设置执行时间或者时间间隔的,具体取值范围和意义如下: 分钟[0-59]

常用linux 命令和.bashrc

ssh [email protected] bashrc 先修改全局的/etc/bashrc, 再考虑修改.bashrc alias ll='ls -alF' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias list='svn st -q' alias svnmeld="svn diff --diff-cmd=meld" (有些版本某些选项没有)export GREP_OPTIONS="--exclude=*.

【Linux基础】常用Linux命令

常用Linux命令:cd, cp, ls, mv, rm cd命令:切换当前工作目录至 dirName(目录参数) 其中 dirName 可为绝对路径或相对路径.若目录名称省略,则变换至使用者的 home 目录 (也就是刚 login 时所在的目录). 另外,"~" 也表示为 home 目录的意思,"." 则是表示目前所在的目录,".." 则表示目前目录位置的上一层目录. cd [dirName] 参数: dirName:要切换的目标目录. 实例