solenoob.blogg.se

Bash grep output file timestamp
Bash grep output file timestamp




bash grep output file timestamp
  1. #Bash grep output file timestamp mac os
  2. #Bash grep output file timestamp install
  3. #Bash grep output file timestamp update
  4. #Bash grep output file timestamp upgrade
  5. #Bash grep output file timestamp full
bash grep output file timestamp

Useful with cat, grep source fname Execute a file fname. wc Count the number of chars, words, lines. uptime Show how long the system's been running. who -a List all users that have logged in recently. date Show current date and time date -rfc-3339=seconds Show time stamp in this format: “yyyy-mm-dd hh:mm:ss-07:00” the last are time offset to UTC. cat /ect/passwd List all users getent group List all groups. id userName Show the id number of a user, and all groups he belongs to. (On Debian based Linuxes, there's higher-level “adduser” written in perl.) passwd userName Change password for user. useradd userName Create a new user account. (Hard link makes 2 files pointing to the same index in the file system (hard disk).) shutdown -r 0 Restart machine now. (symbolic link is basically a file path.) ln newPath existingPath Create hard link of a file. ln -s newPath existingPath Make a symbolic link (aka soft link) of a file. chgrp groupName fileName Change the group of a file. (664 = rw-rw-r- typical text file perm bits) chown userName fileName Change owner of a file. For example, default Ubuntu) chmod 664 fileName Change the perm bits. (useful when root isn't setup as a login account. Linux: Job Control Sys Admin sudo commandString Run a command as “root” (“root” is the name of default admin account.) su Switch to “root” sudo su root Switch to “root”. pstree Show the process parent-child relationshipĪ better program for monitoring processes than “top” is “htop”. Managing Process ps -ef View running processes ps -ef | grep name Find a particular process kill pid Quit a program that has process id pid kill -s 9 pid Force quit a process top Monitor processes with continuous update. Git Basics Fetching and Sync Remote Files: rsync, unison, wget, curl

  • Linux: Text Processing: grep, cat, awk, uniq.
  • Linux: Compression How-to: tar gzip bzip2 xz 7zip rar zip Text Processing This basically copy the binary to /usr/local/bin

    #Bash grep output file timestamp install

    To install and compile a new command, here's the typical steps: gzip -d

    #Bash grep output file timestamp update

    apt-get dist-upgrade Update OS kernel, and others.

    #Bash grep output file timestamp upgrade

    (need to do this regularly) apt-get upgrade Upgrade all installed packages to latest versions (if any). dpkg -l List all installed packages apt-get update Sync package index files from sources. apt-get purge name Remove a program and its config files. (usually used with sudo in front) apt-get remove name Remove (un-install) a program. apt-cache search name Find package name for install by “apt-get” apt-cache show name Describe package name apt-get install name Install a new program. For example, type ls -l /usr/bin to see them. They are searched in order.Įxcutable files must have executable bits on. Linux find executable files by searching the $PATH environment variable. Useful only if you just installed bunch of new commands.) updatedb Update the database used by locate. This is similar to find dir_paths -name "* fname*" but much faster. locate fname Find a file by name (using the database see man updatedb).

    bash grep output file timestamp

    #Bash grep output file timestamp full

    Try type type which cmd Show full path of a command, useful for checking if a program is installed (if it's in the search path in $PATH environment variable.) man cmd View documentation of a command. The command type is a built-in bash command, not a standalone shell util. (For example, text, jpg, png, pdf, ….) Locating Commands type cmd Show if cmd is a shell built-in or standalone program. file fname Report what type of file it is. tail -f fname View the last few lines of a growing file, updated continuously. Log file.) tail fname View the last few lines of a file. head fname View the first few lines of a file. Viewing Files cat fname Display file content cat fname | more View a file by page. (careful!) cp fileName newFileName Copy a file cp -r dirName newName Copy a dir mkdir newDirName Create a new dir rmdir dirName Delete a dir only if it is empty mv fileName newName Rename file, or move to a diff dir. rm fileName Delete a file rm -r dirName Delete a directory. File/Directory Manipulation touch fileName Create a new file, or update timestamp of the file if it exists already. You can set bash to show current dir path and time in your prompt. Many of these command's argument can be either a file name (relative to current directory), or a full file path. Navigate Directory ls List files in current directory ls -al List all files in current dir, including dot files ls -al | grep string Show file name matching string cd dirPath Change directory cd Go to $HOME dir cd.

    #Bash grep output file timestamp mac os

    The code here are based on Ubuntu Linux, but 99% of them work in any unix, including Mac OS X. Most of them are used everyday by every linux user.

    bash grep output file timestamp

    This is a list of most frequently used linux commands.






    Bash grep output file timestamp