_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
| ohazot | docs | links | dev | conf | txt |
| es | en |
| mdoc file |
| search |
command_line_intro —
basic commands
FILES
| Action | Command |
| Move file or directory | : mv SOURCE TARGET |
| Copy file | : cp SOURCE TARGET |
| Copy direcotry | : cp -r SOURCE TARGET |
| Remove file | : rm FILENAME |
| Remove directory | : rm -r DIRECTORY |
The flag -R/-r applies to different commands to execute recursive actions.
FILE CONTENTS
| head | : Get the first 10 lines of a file | : head FILENAME |
| head -15 | : Get the first 15 lines of a file | : head -15 FILENAME |
| tail | : Get the last 10 lines of a file | : tail FILENAME |
| tail -15 | : Get the last 15 lines of a file | : tail -15 FILENAME |
| tail -f | : Get the latest lines of a file continuously | : tail -f FILENAME |
grep
| Get lines matching pattern | : grep PATTERN FILE(S) |
| Get lines not matching pattern | : grep -v PATTERN FILE(S) |
| Get file names not matching pattern | : grep -L PATTERN FILE(S) |
| Get line numbers matching pattern | : grep -n PATTERN FILE(S) |
| Perform a case-insensitive search for pattern | : grep -i PATTERN FILE(S) |
| Perform a recursive search | : grep -R PATTERN DIRECTORY |
NETWORK
Get network information using ifconfig (part of the package net-tools which may need to be installed) or ip.
sudo ifconfig -asudo ip addPIPES
Command output can be redirected to other commands using | .
xargs
| -n | : Maximum number of arguments. |
| -0 | : User NUL as separator instead of the default space and newlines. |
$ echo -e "1\n2\n3" | xargs -n1 echo 1 2 3 $ echo -e "1\n2\n3" | xargs echo 1 2 3 $ echo -e "1\n2\n3" | xargs -0 echo 1 2 3 $ echo "1 2 3" | xargs echo 1 2 3 $ echo "1 2 3" | xargs -n1 echo 1 2 3
SEE ALSO
- Archlinux manpages: mv(1) , cp(1) , rm(1) , tail(1) , head(1) , ifconfig(8) , ip(8) , xargs(1) , grep(1)