macOS and linux commands:
basic 100 commands :
Here are 100 macOS terminal commands with examples:
ls: List directory contents.lscd: Change directory.cd /path/to/directorypwd: Print working directory.pwdmkdir: Make directory.mkdir new_directoryrmdir: Remove directory.rmdir empty_directoryrm: Remove files or directories.rm file.txtcp: Copy files or directories.cp source.txt destination.txtmv: Move or rename files or directories.mv old_name.txt new_name.txttouch: Create an empty file or update the timestamp.touch newfile.txtcat: Concatenate and display file content.cat file.txtecho: Display a line of text.echo "Hello, World!"man: Display the manual page for a command.man lsgrep: Search for patterns within files.grep "search_term" file.txtfind: Search for files in a directory hierarchy.find /path -name "*.txt"chmod: Change file modes or Access Control Lists.chmod 755 script.shchown: Change file owner and group.chown user:group file.txtsudo: Execute a command as another user, typically root.sudo shutdown -h nowps: Report a snapshot of current processes.ps auxtop: Display dynamic real-time view of system processes.topkill: Send a signal to a process.kill -9 PIDdf: Report file system disk space usage.df -hdu: Estimate file space usage.du -sh *ifconfig: Configure network interfaces.ifconfigping: Send ICMP ECHO_REQUEST to network hosts.ping google.comssh: OpenSSH SSH client (remote login program).ssh user@hostnamescp: Secure copy (remote file copy program).scp file.txt user@hostname:/path/to/destinationcurl: Transfer data from or to a server.curl http://example.comwget: Non-interactive network downloader.wget http://example.com/file.ziptar: Archive files.tar -cvf archive.tar file1 file2gzip: Compress files.gzip file.txtgunzip: Decompress files.gunzip file.txt.gzzip: Package and compress files.zip archive.zip file1 file2unzip: Extract compressed files.unzip archive.zipwhich: Locate a command.which pythonwhereis: Locate the binary, source, and manual page files for a command.whereis lsalias: Create an alias for a command.alias ll='ls -la'unalias: Remove an alias.unalias llexport: Set environment variables.export PATH=$PATH:/new/pathenv: Show the environment variables.envhistory: Show the command history.historyclear: Clear the terminal screen.clearnano: Simple text editor in terminal.nano file.txtvi/vim: Powerful text editor in terminal.vi file.txtopen: Open a file or URL in the default application.open file.txtdefaults: Command line interface to the user defaults system.defaults write com.apple.finder AppleShowAllFiles YESdiskutil: Disk utilities.diskutil listhdiutil: Create and manipulate disk images.hdiutil create -volname MyDisk -srcfolder /path/to/folder -ov -format UDZO MyDisk.dmgsay: Convert text to audible speech.say "Hello, World!"spctl: Security policy control.spctl --statussoftwareupdate: System software update tool.sudo softwareupdate -i -abrew: Homebrew package manager.brew install wgetsystem_profiler: System hardware and software configuration information.system_profiler SPHardwareDataTypeioreg: Show the I/O Kit registry.ioreg -lpmset: Power management settings.pmset sleepnownetworksetup: Network settings.networksetup -getinfo Wi-Fiairport: Wireless diagnostics./System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -Icsrutil: System Integrity Protection configuration.csrutil statusnvram: Manipulate firmware NVRAM variables.nvram -pmdfind: Spotlight search from the command line.mdfind "keyword"mdutil: Manage Spotlight indexing.sudo mdutil -E /sips: Scriptable image processing system.sips -z 800 600 input.jpg --out output.jpgtextutil: Manipulate text files of various formats.textutil -convert txt file.rtfpkgutil: Query and manipulate installer packages.pkgutil --pkgstccutil: Manage the privacy database.tccutil reset Cameradiskutil: Disk utilities (again for another use case).diskutil eraseDisk HFS+ NewDisk /dev/disk2dscacheutil: Query and manage the Directory Service cache.dscacheutil -flushcachelaunchctl: Interface with launchd to manage services.launchctl listsudo shutdown: Shut down the system.sudo shutdown -h nowsudo reboot: Reboot the system.sudo rebootsudo halt: Halt the system.sudo haltuptime: Tell how long the system has been running
. sh uptime
date: Display or set the system date and time.cal: Display a calendar.whoami: Print the effective userid.id: Print real and effective user and group IDs.groups: Show which groups the user is a member of.passwd: Change user password.crontab: Schedule periodic jobs.at: Schedule a command to be run at a later time.bg: Resume a suspended job in the background.fg: Resume a suspended job in the foreground.jobs: List active jobs.killall: Kill processes by name.nohup: Run a command immune to hangups, with output to a non-tty.nice: Run a command with modified scheduling priority.renice: Alter priority of running processes.say: Text to speech.osascript: Execute AppleScripts and other OSA language scripts.diskutil: Disk utilities (yet another use case).sudo periodic: Run system maintenance scripts.sudo lsof: List open files.dtrace: Dynamic tracing framework.iotop: Display I/O usage by processes.htop: Interactive process viewer.vm_stat: Show virtual memory statistics.du: Disk usage.df: Disk free space.ioreg: I/O registry.pmset: Power management settings.csrutil: System Integrity Protection status.sh csrutil status
linux commands
Last updated