3

LinuxTech.Me

 1 year ago
source link: https://www.stewalexander.com/linux.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

One Linux page to rule them all!

A fully owned subsidiary of StewAlexander.com
Linux Commands I find Useful
Click or tap on a command for more info!
ac: prints stats about a users connect time in hours, $ac -pd : shows daily user connect time (psacct / acct needs to be installed and running first)
anacron: cron job scheduler for a system that is not running 24 hours a day.
arch: same as uname -m prints the machine name
atop:  daily logging, like htop, may need to download
• bat: Linux cat clone with syntax highlighting and other cool features
bmon: network bandwidth monitor
• $cat /etc/*release : gives you linux / debian release info
$cat /proc/info : gives you processor info
ccze: log colorizer, useful for reading var/log/messages (ex. $sudo tailf /varl/og/messages | ccze or $sudo cat /var/log/messages / ccze -m ansi |less -r)
$cd - : sends the user to the last directory they were in before the present one
$clear : clears the screen
$ctrl-a / $ctrl- e : ctrl-a go to the beginning of a line, ctrl-e go to the end of the line
$ctrl-z : pauses the running process, $bg to background, $fg to return it to the foreground
$df- h : space on volumes, human readable
dig: DNS lookup utility
$dmesg -H : (H flag not available on all systems) boostrap info
$du -hs  : directory sizes, human readable
eject: eject removable media (as in an attached USB flash drive, etc)
env: shows you some info on the shell environment
$mkdir -p : creates full path ex. $sudo makdir -p home/Maildir/{cur,new,tmp}
$export VISUAL=nano; visudo  : sets nano as the visudo editor
$find /etc -name *conf : finds and displays all the config files under /etc
$free -h : show you available space on disks, in human readable format
$grep -Pri: searches for text tin the directory and subdirectories and puts it on the screen, ex : $grep -Pri . searches current directory
head: lists top of file
inode: contains all the information about any linux / Unix file, is an address to a specific disk block, IS the unix file except for the name, which is stored in the directory (together with the inode number) as a reference to the inode data. It truly is the file; the name one sees in the directory is just a reference.
• $inxi -Finc 0 > system_data.txt  : Creates a file that lists a huge amount of system hardware related details, somewhat like the Windows C :\ systeminfo command, requires downloading inxi (click here for details)
$kill $(pgrep mozilla) : Kills all processes associated with Mozilla Firefox, substitute the app name for "mozilla" to kill it.
lastlog: Shows all users that have logged in (or have the capability to login) and the dates and times of their logins, to limit this to those users who have logged in at some point use $lastlog |grep -iv never
• ldd: Lists the library dependencies of an executable
less: Pager, shows any text document where you can move through the document by one line, and or page, at a time
• locate: (may need to run $sudo updatedb first) : fast search for files
• logsave: saves command / terminal/ ssh session output to a file on the desktop with a timestamp
• lsblk: lists all the block devices / partitions of the system
• $lslogins -u : show all users with logins, $lslogins -Lu show last user logins
lsof: list of open files on the system, may require downloading lsof
• lvm: logical volume manager for LUNs and disk partitions
• $man -f : lists details associated with the commands must run $sudo makewhatis first
• $man -k : searches man pages for the word or string 
• $man ascii : outputs an ascii table
nano: text editor, ex $nano mytext, may require downloading nano
•  $ncdu -rx / : Scans the existing file system and orders directories by largest to smallest data size, fantastic for finding where all the free space has gone (think WinDirTree ), may require downloading ncdu
• nl: adds line numbers to a file
• $nmblookup -A: get the (Windows) netbios name from an IP address
• nmon / glances: tools for displaying realtime stats on the system, may require downloading 
• $pstree -p : shows processes and PID in a tree format, very useful
• pushd / popd: collects directories to a stack, moves between stack items
• rev: reverses the output (as in $sudo cat var/log/messages |rev)
• $rpm -qa --last : shows files installed in descending order (non-Debian systems)
• $rpm -qa : list all installed apps (non-Debian systems)
$rpm -qa --last |head : shows recently installed files (non-Debian systems)
• screen: for creating virtual terminals (more useful if logged in remotely, such as by ssh)
• script: logs all transactions of a terminal to a file
• set: shows other shell environmental variables
• ss: socket statistics, $ss -a |grep -E "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b|[^a-z][^:]:[^:][^:][0-9] provides only sockets that are attached to an or any IP address.
• stat: provides user /group data for the file or directory, ex. $sudo stat myfile
$su - : root privallages and root environment, use with caution
• $su : root privallages but keeps the current user environment, good for debugging
• $sudo -k : kills the sudo timer so root access isn't kept
• $sudo -s : Open a shell account with root privileges, use with caution
• $sudo !! : does the previous command again and puts ""sudo"" in front"
• $sudo cat /etc/passwd : show list of users on the system, sudo cat /etc/passwd |grep -iv nologin show all users with logins
• $sudo yum makecache fast : update yum fast mirror package index (non-Debian systems)
tail: lists end of file
• $uname -a : gives you linux kernel information
• users: lists users on the system ($w and $last are also helpful)
• visudo: safe secure way of editting the etc/sudoers file, locks the file, checks syntax
• $yum check-update : shows programs on the system that have available updates
… & more Linux commands herehere, and here

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK