Last active
March 9, 2016 15:08
-
-
Save LolWalid/07ad68f32beda5da5df6 to your computer and use it in GitHub Desktop.
Basic Linux Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.comptechdoc.org/os/linux/usersguide | |
# http://www.tecmint.com/20-advanced-commands-for-linux-experts/ | |
man ls # format and display the on-line manual pages | |
pwd # print working directory | |
cd new_directory # change current directory to new_directory | |
cd ~ # Move to the user's home directory which is "/home/username". The '~' indicates the users home directory. | |
cd # same as cd ~ | |
cd .. # Move to the parent directory of the current directory. | |
cd . # Stay in the current directory, can be useful if you want to reload some ENV variable (exemple: if you have a .rvmrc) | |
ls # list directory contents | |
touch # create a new file or change the modification times | |
# Be careful with this command | |
rm # remove a file | |
rm -r # remove directories and their contents recursively | |
rm * # delete all files in the current directory | |
mkdir -- make directories | |
rmdir -- remove directories | |
cp # copy file | |
cp -r # copy directory | |
mv # move files or directory | |
cat/more/less # file perusal filter (use to read output of cmd or a file) | |
tail # display tail of a file or output | |
head # display tail of a file or output | |
grep | |
find | |
locate # locate a file | |
history # history | |
ps # list processus | |
kill # kill processus | |
emacs / nano / vim / vi # text editor | |
which # locate a program file in the user's path | |
chmod # change permission of a file or directory | |
chown # change owner of a file or directory | |
date # display current date | |
cal # display calendar | |
export # use to set environment variable (as EDITOR) | |
ssh # connect to distant server | |
scp # copy file to or from distant server | |
crontab # list cron list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source : http://www.tecmint.com/20-advanced-commands-for-middle-level-linux-users/ | |
# ssh-tunnel | |
sshfs user@host:/path/to/directory /path/to/mount_folder | |
umount /path/to/mount_folder | |
# mount a disk or usb key | |
mount | |
# start/stop/reload linux services as apache, nginx, mysql, ... | |
service # same as /etc/init.d/ | |
# put this in ~/.bash_rc to get alias for commands | |
alias ls="ls -G" | |
alias la="la -lAh" | |
# overwrite a file | |
echo > | |
# write at end of file | |
echo >> | |
# make links between files | |
ln | |
# pipe the output of first command | |
cmd1 | cmd2 | |
# configuration of network | |
ifconfig | |
# display Linux processes | |
top | |
# Report disk usages of file system | |
df | |
# Estimate file space usage (in current directory) | |
du | |
# Download file, handle HTTP, HTTPS, FTP protocols and HTTP proxies. | |
wget | |
# make http request (GET, POST, ...) | |
curl | |
# ping a server | |
ping | |
# shortcut | |
CTRL + R # search for already executed commands | |
CTRL + F || CTRL + V # next page when using less | |
CTRL + B || CTRL + U # previous page when using less | |
# Tar a file or folder or detar it | |
tar | |
# same as tar but with zip files | |
zip / unzip | |
# create list of arguments | |
xargs | |
# shutdown the system | |
shutdown | |
reboot | |
halt | |
poweroff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment