Last active
April 12, 2016 15:40
-
-
Save blueskyarea/0a21e89bcfc0a8a4ff51 to your computer and use it in GitHub Desktop.
linux command
This file contains 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
// connect remote server with ssh | |
ssh -p {port_number} {host_name(ip_address)} | |
// find file by last modified date(older than 30days ago). | |
find {target_directory} -mtime +30 | |
// delete found files by find command | |
find ./ -name "{file_name}" -exec rm -rf {} \; | |
// replace part of file name(a to b) | |
// find . -type f -print0 | while read -r -d '' file; do mv "$file" "${file/a/b}"; done | |
find . -type f | while read -r file; do mv "$file" "${file/a/b}"; done | |
[option] | |
-type f: find target is file | |
-r : disable escape with backSlash | |
// set shell variable | |
set {VALUE_NAME}=value | |
// copy confirm override and show file name | |
cp -iv {source} {target} | |
[option] | |
i: confirm override(interactive) | |
v: show file name(verbose) | |
// create new tar.gz file | |
tar zcvf {dest}.tar.gz {source} | |
// make multi directory | |
mkdir -p ${directory}/{sub_directory1,sub_directory2} | |
// install deb package | |
dpkg -i {package_name}.deb | |
[option] | |
i: install package | |
// change group temporary | |
newgrp {group_name} | |
// show userId, groupId | |
id | |
// file synchronization | |
rsync -avz {source} {dest} | |
// destruction result of command | |
{command} > /dev/null 2>&1 | |
// output each directory created message | |
mkdir -v {directory_name} | |
// input file and delete \n and output file | |
tr -d "\n" < {input_file} > {output_file} | |
// get package list from server | |
apt-get update | |
// download public key | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys {key} | |
// set environment variable | |
setenv {environment_variable} {value} | |
// copy keep file attribute and directory structure as much as possible | |
copy -a {source} {dest} | |
// echo 11 to 20 | |
echo `seq 11 20` | |
// show file list order by modified date | |
ls -alt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment