# Number of available commands in your terminal
ls /usr/bin | wc -l
# List files in folder for humans
ls -lh
ls -lh *csv*
# All files where file name or extension contents csv
# Directory
pwd
# move
mv origin destionation
# copy
cp origin destination
# Manual
man ls
# or other command.
# Move a directory with current reference
pushd directory
# Move back to old directory
popd
# Open
open element
open .
# Some information exaple in a file, less is the new way
more file
less file
# Straming con cat
cat > myfile
# It will wait for your input and save the info there
# last lines in file, the number is number of lines, detault is 10
tail -# myfile
# Where is the binary for someone
which mycondad
which ls
echo $PATH
# Command alias
alias ll='ls -lh'
# Util alias
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^//' -e 's/-/|/'"
# Streamings
std file
tail -f file
# Create a new file with the exit
php file.php 1> exit 2> error
# Continue writing where last file ended
php file.php 1>> exit 2>> error
# Write exit in the same output
php file.php 1>> exit 2>> $1
# Show process
top
ps -wa
# Kill process
kill -9 numeric-id
# How many time your machine is up
uptime
# Search
grep -r . -e exp
# Count
grep -r . -e exp | wc -l
# exlucde this files with -v
grep -v
# not match with case sensitive
grep -i
# find files
find . -name *.php
ls *.php
# Curl
wget url
wget url > file.ext
wget url -o file.ext
# Zip
zip filename.zip *.csv
# Unzip
# it will show all files in the zip
unzip -vl file.zip
# Tar
tar cfz filename.tar.gz *csv
tar xfx filename.tar.gz
# AWK
cat aeropuertos.csv | awk –F"," '{printf("%s, %s\n", $3, $2)}' | more
# Crontab
# ┌───────────── min (0 - 59)
# │ ┌────────────── hour (0 - 23)
# │ │ ┌─────────────── day of month (1 - 31)
# │ │ │ ┌──────────────── month (1 - 12)
# │ │ │ │ ┌───────────────── day of week (0 - 6) (0to6 are Sunday to Saturday, or use names; 7is Sunday, the same as 0)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command toexecute
# List crons process
crontab -l
# Add crontab
crontab -e
# Size for files
du
# Human
du -h
# Huamn with single level view
du -h -d 1
# Files with more than 2G
find / -type f -size +2G -exec ls -lh {} \; | awk '{ print$9": "$5 }'
find . -type f -size +1M -exec ls -lh {} \; | awk '{ print$9": "$5 }'
# Alias
ln -s [directory route] [alias name]
# show all alias
ls -la | grep ^l
# Users and permisions
whoami
000->0
001->1
010->2
011->3
100->4
101->5
110->6
111->7
— -> 0
–x -> 1
-w- -> 2
-wx -> 3
r-- -> 4
r-x -> 5
rw- -> 6
rwx -> 7
r: read
w: write
x: execution
Introducción a Terminal y Línea de Comandos 2018
0 Comentarios
para escribir tu comentario